Action Visibility Rules
Actions can be dynamically shown, hidden, enabled, or disabled based on the current form state. Two mechanisms control this: visibilityRule for show/hide and disabledRule for enable/disable. Both accept expressions evaluated against the current form values.
visibilityRule — Show or Hide
The visibilityRule expression is evaluated reactively as form values change. When the expression returns false, the button is hidden entirely (not just greyed out). When it returns true, the button is visible.
// Show "Approve" button only when status field is "pending"
{
"type": "custom",
"label": "Approve",
"variant": "primary",
"visibilityRule": "values['approval-status'] === 'pending'"
}
// Show "Delete" only in admin mode
{
"type": "custom",
"label": "Delete Record",
"variant": "danger",
"modeVisibility": {
"edit": false,
"admin": true
}
}
disabledRule — Enable or Disable
The disabledRule expression controls whether the button is clickable. When true, the button renders in a greyed-out, non-interactive state. Unlike visibilityRule, the button remains visible — users can see it but cannot click it.
// Disable submit until required agreement is checked
{
"type": "submit",
"label": "Submit Application",
"variant": "primary",
"disabledRule": "!values['terms-accepted'] || !values['privacy-accepted']"
}
// Disable link action when no row selected
{
"type": "link",
"label": "Edit Selected",
"disabledRule": "!values['selected-row-id']"
}
Mode Visibility
Use modeVisibility to show/hide buttons based on the form's operating mode:
{
"type": "submit",
"label": "Save",
"modeVisibility": {
"edit": true,
"view": false, // Hide in view mode
"admin": true,
"preview": false // Hide in preview
}
}
Combining Rules
A button must pass ALL active rules to be shown and enabled:
modeVisibilityfor the current mode must betruevisibilityRulemust evaluate totruedisabledRulemust evaluate tofalse(not disabled) for the button to be clickable
Expression Context
Expressions have access to:
| Variable | Type | Description |
|---|---|---|
values | object | Current form field values keyed by field ID |
mode | string | Current operating mode (edit, view, admin, etc.) |
isDirty | boolean | Whether the form has unsaved changes |
isValid | boolean | Whether all validation rules pass |
isSubmitting | boolean | Whether a submission is in progress |