Atlas Forms
Visibility Overview
Atlas Forms provides two independent visibility systems: modeVisibilitySettings controls which operating modes show a control, and visibilityRule controls whether a control is shown based on the current values of other fields. Both must evaluate to visible for a control to appear.
The Two Systems
| System | Controls | Evaluated When | Use For |
|---|---|---|---|
modeVisibilitySettings | Which operating modes show this control | Once per mode change (static per session) | Admin-only fields, design-mode hints, preview-mode cleanup |
visibilityRule | Whether to show this control given current field values | Reactively on every value change | Conditional fields ("Show address if different billing"), required-if patterns |
AND Logic Between Systems
A control is visible only when BOTH systems say it is visible:
// A control is shown only when:
// modeVisibilitySettings[currentMode] === true
// AND
// visibilityRule evaluates to true (or is absent)
isControlVisible = modeCheck(control, currentMode) && expressionCheck(control, values)
Quick Comparison
| Aspect | modeVisibilitySettings | visibilityRule |
|---|---|---|
| Schema location | control.modeVisibilitySettings | control.visibilityRule |
| Type | Object of boolean flags per mode | String expression |
| Dynamic? | No — fixed at schema authoring time | Yes — evaluated reactively |
| Depends on other fields? | No | Yes |
| Default (when omitted) | Visible in all modes | Always visible |
Pages in This Guide
| Page | Topic |
|---|---|
| modeVisibilitySettings | Per-mode boolean flags: edit, view, design, admin, preview |
| Default Visibility | What happens when modeVisibilitySettings is omitted |
| visibilityRule | Expression-based conditional visibility |
| Expression Syntax | How to reference field values in visibility expressions |
| Combining Both Systems | Mode + expression AND logic in practice |
| useFormVisibility Hook | isVisible(), getVisibleControls() for custom players |
| Practical Examples | Admin-only fields, conditional address block, view-only summary |