aura:if evaluates the isTrue expression on the server and instantiates components in either its body or else attribute. Only one branch is created and rendered. Switching condition unrenders and destroys the current branch and generates the other
<aura:component> <aura:if isTrue="{!v.truthy}"> True <aura:set attribute="else"> False </aura:set> </aura:if> </aura:component>
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 |