Skip to content

Conditional rendering

The <if> tag is used for conditional rendering. If the specified condition does not hold the content of the <if> tag is not evaluated.

html
<if true="item.isActive">
  <div>Item is active</div>
</if>
AttributesUse
true="…"Render the content only if some variable holds the value true.
false="…"Render the content only if some variable holds the value false.
empty="…"Render the content only if some variable holds an empty array.
Only one condition may be used per tag. Using multiple conditional attributes simultaneously is invalid and will result in a compile-time error.