Portal Community

Type Definition

// packages/types-js/src/form.types.ts

interface ModeVisibilitySettings {
  edit?:    boolean;   // Visible when mode = 'edit'
  view?:    boolean;   // Visible when mode = 'view'
  design?:  boolean;   // Visible when mode = 'design'
  admin?:   boolean;   // Visible when mode = 'admin'
  preview?: boolean;   // Visible when mode = 'preview'
}

// On FormControl:
interface FormControl {
  // ...
  modeVisibilitySettings?: ModeVisibilitySettings;
}

Examples

// Show ONLY in admin mode (e.g., internal audit fields)
{
  "id":   "internal-notes",
  "type": "textarea",
  "modeVisibilitySettings": {
    "edit":    false,
    "view":    false,
    "design":  false,
    "admin":   true,
    "preview": false
  }
}

// Show in edit and view, hide in preview (editing controls irrelevant in preview)
{
  "id":   "price-override",
  "type": "number",
  "modeVisibilitySettings": {
    "edit":    true,
    "view":    true,
    "design":  true,
    "admin":   true,
    "preview": false
  }
}

// Developer diagnostic control — hide in all user-facing modes
{
  "id":   "debug-inspector",
  "type": "variable-inspector",
  "modeVisibilitySettings": {
    "edit":    false,
    "view":    false,
    "design":  true,   // visible only in design mode for developers
    "admin":   false,
    "preview": false
  }
}

The Five Modes

ModePurposeTypical Audience
editUser fills in the form — controls are interactiveEnd users, workflow participants
viewRead-only display of submitted dataReviewers, supervisors
designForm schema editor in Atlas Forms StudioForm authors, developers
adminAdministrative override view — may show extra internal fieldsPlatform administrators
previewPreview a form before publishing — simulated user viewForm authors checking layout

Partial Specification

You only need to specify modes where the behaviour differs from the default. Any mode you omit defaults to visible:

// Omitting a mode = visible in that mode
// This is equivalent to specifying all modes as true:
{
  "modeVisibilitySettings": {
    "preview": false   // Only hide in preview; visible in all other modes
  }
}
Use Partial Specification to Minimise Noise Only specify the modes where you want to deviate from the default (visible). Specifying all five flags explicitly makes the schema harder to read. A setting like { "admin": true } alone is meaningless — it defaults to true. Only specify "admin": true when you have also specified other modes as false.