Newer Version Available
aura:if
Conditionally instantiates and renders either the body or the components in the else attribute.
aura:if evaluates the isTrue expression on the server and instantiates components in either its body or else attribute.
This example renders the body since isTrue evaluates to
true.
1<aura:attribute name="display" type="Boolean" default="true"/>
2<aura:if isTrue="{!v.display}">
3 Show this if true
4 <aura:set attribute="else">
5 Show this if false
6 </aura:set>
7</aura:if>Attributes
| Attribute Name | Attribute Type | Description | Required? |
|---|---|---|---|
| body | ComponentDefRef[] | The components to render when isTrue evaluates to true. | Yes |
| else | ComponentDefRef[] | The alternative to render when isTrue evaluates to false, and the body is not rendered. Should always be set using the aura:set tag. | |
| isTrue | Boolean | An expression that must be fulfilled in order to display the body. | Yes |