Atlas Forms
Modal Dialog Trigger
The modal layout control renders a trigger button. When clicked, it opens a modal dialog containing the controls from a referenced section. Controls inside the modal are part of the main form — their values are submitted with the rest of the form data.
Minimal Example
{
"id": "add-contact-modal",
"type": "modal",
"order": 5,
"width": "half",
"settings": {
"triggerLabel": "Add Contact",
"triggerIcon": "fa-solid fa-plus",
"modalTitle": "Add Contact Details",
"sectionId": "sec-contact-details",
"size": "md"
}
}
Settings Reference
| Setting | Type | Default | Description |
|---|---|---|---|
triggerLabel | string | — | Text on the button that opens the modal |
triggerIcon | string (FA class) | — | Icon on the trigger button |
triggerVariant | primary | secondary | outline | ghost | secondary | Button style |
modalTitle | string | — | Modal dialog header text |
sectionId | string | — | Form section displayed inside the modal |
size | sm | md | lg | xl | full | md | Modal dialog width |
closeOnOutsideClick | boolean | true | Close modal when clicking the backdrop |
showCloseButton | boolean | true | Show × button in modal header |
confirmLabel | string | "Confirm" | Label for the modal's confirm button |
cancelLabel | string | "Cancel" | Label for the modal's cancel button |
validateOnConfirm | boolean | true | Validate section controls before closing on confirm |
How Modal Values Are Submitted
Controls inside the modal section write their values to the form engine's state just like any other control. When the form is submitted, the submit action handler receives all values including those from the modal section in ctx.formValues:
// Form schema with modal
{
"id": "beneficiary-modal",
"type": "modal",
"settings": {
"triggerLabel": "Add Beneficiary",
"sectionId": "sec-beneficiary"
}
}
// sec-beneficiary contains:
// - text: beneficiary-name
// - text: beneficiary-relationship
// - number: beneficiary-percentage
// In submit handler:
ctx.formValues['beneficiary-name'] // "Jane Smith"
ctx.formValues['beneficiary-relationship'] // "Spouse"
ctx.formValues['beneficiary-percentage'] // 50
Terms Agreement Modal
{
"id": "terms-modal",
"type": "modal",
"order": 20,
"settings": {
"triggerLabel": "View Terms and Conditions",
"triggerIcon": "fa-solid fa-file-contract",
"triggerVariant": "outline",
"modalTitle": "Terms and Conditions",
"sectionId": "sec-terms-content",
"size": "lg",
"confirmLabel": "I Accept",
"cancelLabel": "Close",
"validateOnConfirm": false,
"closeOnOutsideClick": false
}
}
// sec-terms-content contains:
// - html control with full T&C text
// - checkbox: "terms-accepted"
Modal Sizes
| Size | Max Width | Use For |
|---|---|---|
sm | 400px | Confirmation dialogs, single field input |
md | 600px | Short forms, 2-4 field input |
lg | 800px | Medium forms, document display |
xl | 1000px | Complex forms, data tables |
full | 100vw | Full-screen modals, large editors |