Atlas Forms
Action Schema Reference
The complete TypeScript interface for a form action. Every action in the actions[] array conforms to this shape. Understanding the schema is the foundation for building correct, predictable action bars.
FormAction Interface
interface FormAction {
// Required
type: FormActionType; // submit | cancel | reset | navigate | link |
// addQuickItems | deleteSelected | custom
label: string; // Button label text
// Optional styling
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
icon?: string; // Font Awesome icon name (e.g., 'save', 'trash')
iconPosition?: 'left' | 'right'; // Default: left
size?: 'sm' | 'md' | 'lg'; // Default: md
fullWidth?: boolean; // Stretch button to full container width
// State
disabled?: boolean; // Static disable
disabledRule?: string; // Expression-based disable (evaluated against values)
loading?: boolean; // Show spinner (useful for async actions)
// Visibility
visibilityRule?: string; // Expression — action hidden when false
modeVisibility?: { // Same pattern as controls
edit?: boolean;
view?: boolean;
admin?: boolean;
preview?: boolean;
};
// Sort
order?: number; // Action bar position (ascending = left to right)
// Action-specific config
config?: FormActionConfig; // See per-action pages for config shape
// Identifiers
id?: string; // Optional ID for targeting in custom logic
testId?: string; // QA test attribute
}
FormActionType Enum
type FormActionType =
| 'submit' // Validate + call onSubmit
| 'cancel' // Discard + navigate away
| 'reset' // Reset to initialValues
| 'navigate' // Route to URL/step
| 'link' // Matrix dispatch to child form
| 'addQuickItems' // Insert preset rows in data-table
| 'deleteSelected' // Delete checked rows in data-table
| 'custom'; // Registered custom handler
FormActionConfig Shapes
The config object is typed differently per action type:
Submit Config
interface SubmitActionConfig {
validateBeforeSubmit?: boolean; // Default: true
showConfirmDialog?: boolean; // Ask user before submitting
confirmMessage?: string; // Dialog message text
successMessage?: string; // Toast shown after successful submit
errorMessage?: string; // Toast shown if submit fails
}
Cancel Config
interface CancelActionConfig {
checkDirty?: boolean; // Default: true — warn if unsaved changes
dirtyWarningMessage?: string; // Custom warning text
navigateTo?: string; // URL to navigate to after cancel
}
Navigate Config
interface NavigateActionConfig {
url: string; // Target URL (absolute or relative)
target?: '_self' | '_blank'; // Default: _self
openInTab?: boolean; // Same as target: _blank
}
Link Config (Matrix Dispatch)
interface LinkActionConfig {
targetFormId: string; // Form name to navigate to
keyField: string; // Field ID whose value is the record key
queryParam?: string; // URL param name (default: 'id')
}
addQuickItems Config
interface AddQuickItemsConfig {
targetControlId: string; // data-table control to add rows to
items: Record<string, any>[]; // Preset row objects to insert
}
Custom Config
interface CustomActionConfig {
handlerType: string; // Registered handler key
handlerConfig?: Record<string, any>; // Passed to handler as context.config
}
Complete Action Example
{
"actions": [
{
"type": "submit",
"label": "Save Policy",
"variant": "primary",
"icon": "check",
"order": 2,
"config": {
"validateBeforeSubmit": true,
"successMessage": "Policy saved successfully"
}
},
{
"type": "cancel",
"label": "Discard Changes",
"variant": "ghost",
"icon": "times",
"order": 0,
"config": {
"checkDirty": true,
"dirtyWarningMessage": "You have unsaved changes. Discard them?"
}
}
]
}