Skip to content

Conditions

Any block or section can carry a visibleWhen rule. The Conditional block wraps a group of blocks in one rule and shows a badge in design mode.

Building rules without code

The inspector's rule builder produces a structured group that compiles to the expression language:

json
{
  "op": "and",
  "rules": [
    { "left": "client.isRetired", "operator": "isTrue" },
    { "op": "or", "rules": [
      { "left": "portfolio.riskScore", "operator": "gt", "right": 7 },
      { "left": "client.riskProfile", "operator": "eq", "right": "Adventurous" }
    ] }
  ]
}

compiles to (client.isRetired == true) and ((portfolio.riskScore > 7) or (client.riskProfile == "Adventurous")).

Operators: eq neq gt gte lt lte contains startsWith endsWith in isEmpty isNotEmpty isTrue isFalse. The right-hand side may be a literal or another field written as {{ field }}.

Expressions

Power users can switch the builder to a raw expression: portfolio.riskScore > 7 and not client.isRetired. Syntax errors are shown inline and reported by validate().

Behaviour by mode

  • Preview / PDF: hidden content is removed entirely; nothing is reserved for it and pagination flows as if it never existed.
  • Design: hidden content stays visible, dimmed, with a "Hidden with sample data" badge so designers can still edit it. Switch the sample data set from the toolbar to see the other branch.

Empty repeaters

A common pattern is a conditional shown only when a list is empty:

text
isEmpty(recommendations.items)

paired with a repeater over the same list. The demo template does exactly this for "No changes recommended".