Visibility

Dynamic Element Visibility — anywhere inside an instance.

Setup

Attribute: sf-react = visibility(expression) (see WTF is an expression?)

Where: any HTML element within the form to control its visibility dynamically.

Pro Tip

It's particularly effective when used to display real-time changes based on form data and variables such as $f, $v, $s, $p (see Form Data & Variables).

You can inject JavaScript expressions directly, leveraging operators like >, <, ==, ===, and the ternary ?: operator in sf-react to enable robust, condition-based visibility updates—perfect for interactive, responsive form elements.

Implement logical operators (&&, ||, !) to combine conditions, enhancing the complexity as needed while ensuring they result in a boolean outcome.


Examples

1. Visibility based on age

Text message displayed when age number input is >= 18.

2. Conditional success messages on form submit

Different success messages example based on age input.

Last updated

Was this helpful?