Expressions are Yell’s way to add minimal logic to YAML without turning it into a general-purpose programming language.
Yell is designed for structured, predictable UI. If YAML allowed arbitrary logic:
So Yell supports only the expressions that genuinely need to be in the declarative layer.
Conditional visibility. Component renders only when condition is true.
- type: Modal
showWhen: isOpen == true
- type: AdminPanel
showWhen: user.role == 'admin'
- type: DisabledMessage
showWhen: isDisabled && count > 0
One-way data binding. Connects a prop to application state.
- type: Input
bind:
value: form.name
onChange: form.name = $event
- type: Checkbox
bind:
checked: form.acceptTerms
onChange: form.acceptTerms = $event
Conditional rendering with two branches.
- type: Badge
if: user.role == 'admin'
then:
- type: AdminBadge
else:
- type: UserBadge
- type: StatusIndicator
if: isOnline
then:
- type: OnlineDot
else:
- type: OfflineDot
showWhen: value == other
showWhen: count != 0
showWhen: age > 18
showWhen: score < 100
showWhen: isVisible && isEnabled
showWhen: isAdmin || isModerator
showWhen: !isDisabled
showWhen: isVisible && !isDisabled && count > 0
showWhen: isAdmin || (isModerator && isActive)
These will be blocked by the linter:
# ❌ BLOCKED — inline functions
onClick: () => alert('bad')
# ❌ BLOCKED — function calls
showWhen: getStatus(user) == 'active'
# ❌ BLOCKED — complex operations
showWhen: users.filter(u => u.active).length > 5
# ❌ BLOCKED — mutations
onChange: count = count + 1
# ❌ BLOCKED — ternary (use if/then/else instead)
showWhen: isAdmin ? true : false
# ❌ BLOCKED — string operations
showWhen: name.includes('admin')
$event represents the current event value in onChange handlers:
bind:
value: form.email
onChange: form.email = $event
In onClick, $event is typically null:
- type: Button
props:
label: "Submit"
onClick: handleSubmit
# ✅ Good — simple and clear
showWhen: isModalOpen
showWhen: user.role == 'admin'
# ❌ Avoid — hard to read
showWhen: a && b || c && (d || e)
# ✅ Better — extract to state
showWhen: canShowPanel
# ✅ Correct for state updates
bind:
onChange: form.count = $event
# Then in your handler:
setForm(f => ({ ...f, count: f.count + 1 }));
Yell evaluates expressions in this order:
Expressions are evaluated client-side during hydration. SSR output does not include expression results — they’re computed at runtime.