ifTrue or ifFalse widget.
Properties
| Property | Type | Description |
|---|---|---|
| condition | String | Required. The boolean expression to evaluate at runtime. |
| ifTrue | StacWidget | Required. The widget to render when condition evaluates to true. |
| ifFalse | StacWidget | The widget to render when condition evaluates to false. Renders empty if null. |
Example
Conditional with Complex Widgets
Condition Expression Syntax
Thecondition property accepts expressions that are evaluated against the current state. Common patterns include:
- Equality:
user.role == 'admin' - Boolean check:
user.isVerified == true - Comparison:
cart.total > 100 - Length check:
items.length > 0 - Null check:
user.name != null
The condition is evaluated at runtime by Stac’s expression resolver against the current application state.