Skip to main content

If

Renders its children conditionally, based on the truthiness of a path.

Signature

Attributes

Truthiness rules

Example

Runtime behavior

  • When the condition is false the subtree does not render at all, but Data inside it is still prefetched (it was collected at parse time).
  • There is no Else; for an either/or case use two opposite conditions, or return the state from a script.
  • Test accepts {...} or a bare path.

Gotchas

  • An empty array counts as false; to detect “the array exists but is empty”, check its length or use a script result.
  • Do not put Resources / Triggers / Function inside If; they are only allowed at the root.