Newer Version Available

This content describes an older version of this product. View Latest

aura:if

aura:if renders the content within the tag if the isTrue attribute evaluates to true.

The framework evaluates the isTrue expression on the server and instantiates components either in its body or else attribute.

aura:if instantiates the components in either its body or the else attribute, but not both. aura:renderIf instantiates both the components in its body and the else attribute, but only renders one. If the state of isTrue changes, aura:if has to first instantiate the components for the other state and then render them. We recommend using aura:if instead of aura:renderIf to improve performance. Only consider using aura:renderIf if you expect to show the components for both the true and false states, and it would require a server round trip to instantiate the components that aren't initially rendered. Otherwise, use aura:if to render content if a provided expression evaluates to true.

Note

Attribute Name Type Description
else ComponentDefRef[] The markup to render when isTrue evaluates to false. Set this attribute using the aura:set tag.
isTrue string Required. An expression that determines whether the content is displayed. If it evaluates to true, the content is displayed.