Skip to content

Show and hide components

Every component except the page stack and pages can carry a Show when condition. It is stored in the element’s visible field and evaluated against live state on every render.

Select the component, find Show when, and press Add condition. Each row is a state path, an operator and — unless the operator is is truthy — a value. With several rows, all must hold. Tick a row’s Not to invert that row: it then holds exactly when it otherwise would not, stored as "not": true on its part.

Switch the match from All of to Any of to show the component when any one of several groups holds. Each group is its own list of rows that must all hold; Add group starts another, up to 8. The rows you already have become the first group, and back on All of a single group’s rows are kept.

Operator Stored as Holds when
is truthy { "$state": "/p" } the value is truthy (not false, 0, "", null or missing)
equals { "$state": "/p", "eq": v } the value is exactly v
≠ { "$state": "/p", "neq": v } the value is anything but v
> ≥ < ≤ gt gte lt lte both sides are numbers and the comparison holds

A comparison value is text, a number, true/false or null — or, in JSON, { "$state": "/other" } to compare two state values. The ordered operators accept only a number or a $state read.

Equality is strict: the number 1 does not equal the text "1", and a value that was never set does not equal false. Seed a flag to false if a condition compares it with eq: false, or use is truthy instead.

"visible": [
{ "$state": "/steps/laptop", "eq": true },
{ "$state": "/steps/accounts", "eq": true }
]

With Any of, one Next can serve two ways of finishing a step — talks, or the workshop once dietary needs are filled:

"visible": { "$or": [
{ "$state": "/form/track", "eq": "talks" },
[{ "$state": "/form/track", "eq": "workshop" }, { "$state": "/form/dietary" }]
] }

Not combines with every operator. On is truthy it means the value is falsy or missing; on equals and ≠ it swaps them; on an ordered operator it holds whenever the comparison fails, including when either side is not a number. For example, to show a message while a local list is empty:

"visible": { "$state": "/todos/0", "not": true }

The canvas ignores conditions so hidden components stay selectable. Use the preview to see them take effect.

A boolean $expr may be the whole Show when condition — not mixed into an All of / Any of list. The same formula may fill $cond on Required, Disabled and Busy, and an input’s Required when. Arithmetic, comparison, and / or / not, isEmpty and if are the functions; a $state read inside those counts as true only when the value is exactly true, so test text and lists with Is empty. Import refuses $expr in setState, object inputs and host-action params.

When the condition is already a formula, the Inspector is in formula mode: it shows a Formula · … summary (the function and its operands as text) and Remove, then the formula editor — Formula (or Nested formula), operands as Number, True/false, Text, State, Row field or Formula, and Add operand. Remove clears the formula. On Show when, that returns you to the row editor; on Required, Disabled and Busy it switches back to Static (off). There is no Formula choice beside Add condition; a formula arrives from import or AI mode, and once it is there you edit it in place.

A Next button that stays disabled until name and email are filled:

"disabled": {
"$cond": {
"$expr": "or",
"args": [
{ "$expr": "isEmpty", "args": [{ "$state": "/form/name" }] },
{ "$expr": "isEmpty", "args": [{ "$state": "/form/email" }] }
]
},
"$then": true,
"$else": false
}

See Hold a Button until the form is ready.

Import refuses — with a message saying so — $and, an $or nested inside a group or a list, a plain true/false as a condition, $computed, and the $item/$index reads that belong to list generation. Any of goes one level deep: list every part a group needs inside that group. A boolean $expr must be the whole condition, not a row inside All of / Any of.

Because the runtime projects each declared object into state, conditions are how a document shows loading, error and permission states:

Show when Condition
a record is loaded { "$state": "/objects/customer/data" }
the fetch is running { "$state": "/meta/objects/customer/operations/fetch/phase", "eq": "loading" }
the last save failed { "$state": "/meta/objects/customer/operations/update/phase", "eq": "error" }
the host allows deleting { "$state": "/meta/objects/customer/capabilities/delete/allowed", "eq": true }
a field is read-only { "$state": "/meta/objects/customer/fields/contact.email/writable", "eq": false }
an input was rejected { "$state": "/meta/objects/customer/operations/update/error/fieldErrors/displayName" }

Hiding a button because an operation is not allowed is a courtesy, not security: the host still authorizes every call it receives.