What are States?
States let you conditionally show or hide parts of your widget based on current data values. Each state has a name, a visibility condition, and wraps a section of content in the widget code. When a state is active, the content inside it is visible. When inactive, the content is hidden.Using States in the Code
To use a state, wrap the components you want to control in a tag that matches the state name. For example, a state named “Loading” wraps content in a<Loading> tag:
<Text value="Please wait..." /> element is visible. The rest of the widget renders normally regardless of the state.
Multiple Active States
Multiple states can be active at the same time. Each state independently controls the visibility of its own wrapped content.Visibility Modes
Each state has a visibility mode that determines when its content is shown.| Mode | Behavior |
|---|---|
| Always visible | The state is always active. Wrapped content is always shown. |
| Always hidden | The state is never active. Wrapped content is always hidden. |
| Conditional | The state is active only when its configured conditions are met. |
Operators
When using conditional visibility, each condition compares a data field against a value using an operator.| Operator | Description |
|---|---|
| equal to | Exact match against the comparison value. |
| not equal to | Does not match the comparison value. |
| contains | The field contains the comparison value as a substring. |
| not contains | The field does not contain the comparison value as a substring. |
| greater than | The field is greater than the comparison value. |
| less than | The field is less than the comparison value. |
| is empty | The field has no value. No comparison value is needed. |
| is not empty | The field has a value. No comparison value is needed. |
Combining Conditions
You can combine multiple conditions using AND and OR connectors.- AND — All conditions must be true for the state to be active.
- OR — At least one condition must be true for the state to be active.
statusequal to “active” ANDroleequal to “admin”
The connector (AND/OR) is set on each condition individually, starting from the second condition onward. The first condition has no connector.
Condition Groups
For more complex logic, you can nest conditions into groups. Each group is evaluated as a unit, and groups are connected to each other with AND or OR. This lets you express logic like:(In this example, the state is active when the status is “active” and the role is either “admin” or “editor.”statusequal to “active” ANDroleequal to “admin”) OR (statusequal to “active” ANDroleequal to “editor”)
States Tab in the Builder
You manage states from the States tab in the widget builder. Each state is displayed as a card with the following controls:- Name — The state name, which must match the tag used in the widget code.
- Visibility dropdown — Choose between Always visible, Always hidden, or Conditional.
- Conditions — When set to Conditional, configure one or more conditions with fields, operators, values, and connectors.
- Cancel / Done — Discard or save your changes to the state.
States are different from Named Examples. Named Examples are data presets used for previewing different scenarios in the builder. States control conditional visibility of widget content at runtime based on actual data values.