WTF is an expression ? ๐
For no-code and low-code users who want to build smarter forms without writing code.
Definition
An expression is a tiny formula that tells Superform:
โWatch this input, and when it changesโฆ do something.โ
or
โIf this happens โ do that.โ
Itโs just logic. Like what youโd use in a calculator or spreadsheet:
2 + 2 // โ 4
$f.age > 18 // โ true
$f.price * $f.quantity // โ 2 * 18 = 36You use expressions inside attributes like sf-react and Superform updates the DOM (HTML elements) automagically.
Example expressions
๐ Live name preview
<p>Welcome back <span sf-react="text($f.name)">Name</span></p>โ $f.name comes from an <input name="name">.
โ Updates the span with what the user typed in the name input.
Refer to Update Text reactivity for more information and Webflow examples!
๐งฎ Show total price
โ $f.price and $f.quantity come from <input name="price"> and <input name="quantity">.
โ Calculates and displays price ร quantity as the user types/selects quantities.
Refer to Update Text reactivity for more information and Webflow examples!
๐ Show warning if underage
โ $f.age comes from an <input name="age" type="number">.
โ Shows the message only if the entered age is under 18.
Refer to Visibility reactivity for more information and Webflow examples!
๐ฉ Highlight selected plan
โ $f.plan comes from a group of radio buttons or a <select name="plan">.
โ Toggles the active class when the selected plan is "pro".
Refer to Class Toggle feature for more information and Webflow examples!
โ
Show message based on score with ternary operator (advanced)
โ $v.score is a custom score variable calculated using sf-score-calc.
โ Shows "Great job!" if the score is above 5, otherwise "Keep going!".
Refer to Update Text and Score Setup & Calculation feature for more information and Webflow examples!
๐ช Highlight the active step visually (advanced)
โ $s is the current step index (starts at 0).
โ Adds the active-step class only when you're on Step 3 (index 2).
Useful for styling progress indicators, steppers, or conditional content blocks.
Refer to Class Toggle feature and Progress Percentage ($p) variable for more information and Webflow examples!
What can I use inside Expressions
Inside expressions, you can combine:
โ Superform variables like
$f,$s,$p, and$vโ Superform functions like
text(),value(),visibility(),class(), andattr()โ Basic JavaScript logic like math, comparisons, strings, and ternary operators
๐ง Variables overview (see Variables)
$f
Form data (like $f.name, $f.email, etc)
$s
Current step index (useful in multistep forms)
$p
Progress value (%)
$v
Score variables ($v.totalScore, etc)
๐ ๏ธ Reactivity features
text(value)
Updates the elementโs text
value(value)
Sets the value of an input or element
visibility(condition)
Show/hide the element
class(condition, 'classname')
Adds a class if true
attr(value, 'attribute')
Sets a custom attribute
Last updated
Was this helpful?