Form element
npm install @exmg/exm-form The Exmg Form enhances form design by offering a more intuitive layout visualization, streamlining the user experience with several key features. These include:
- Automated form validity checks, ensuring data integrity
- Dynamic submit button control, which enables or disables the button based on form completeness
- JSON output capability, allowing for easy data serialization and integration
- A loading spinner, providing a visual indicator for asynchronous form submissions
``sh`
npm install @exmg/exm-form
`html`
Ex Machina will send notices about the Data Processing Terms and EU General Data Protection
Regulation to your primary contact. If your organization has a data protection officer or an EU representative, add
their contact information.
`js`
async function doFormAction(e: CustomEvent
const formDialog = e.target as ExmForm;
try {
formDialog.submitting = true;
// Do server call
// Show success message
} catch (error) {
console.error(error instanceof Error ? error.message : 'Unknown error');
} finally {
formDialog.submitting = false;
}
}
| Name | Type | Default | Description |
| ----------------- | --------- | -------- | --------------------------------------------------------- |
| submitBtn | string | Save | Submit button copy |cancelBtn
| | string | Cancel | Cancel button copy |submitting
| | boolean | false | Indicated form submit in progress and disables the button |hasAsideContent
| | boolean` | false | Indicated if form has a side help section |
For other options see the m3 docs: