Skip to content

States

States are named boolean expressions over the live form data. Declare them once in formConfig.states, then reference the names from include / exclude rules, per-state property overrides, and selectors.

const formConfig = {
states: {
hasDiscount: '$form.hasDiscountCode === true',
isAdult: '$form.driverAge >= 18',
},
};

Expressions are JavaScript-like. The engine exposes:

  • $form — the current form data tree.
  • Standard operators: &&, ||, !, ===, !==, <, >, <=, >=, +, -, *, /, ?:.
  • Optional chaining: $form.user?.name.

Expressions can reference any path in the form data.

  • In include / exclude rules: gate widgets.
  • In per-state property overrides on shortcuts: change props when active.
  • In gui.selectors.state(...) chains: scope a selector to one state.