If

aura:if

Conditionally instantiates and renders either the body or the components in the else attribute.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App

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.

1<aura:component>
2  <aura:if isTrue="{!v.truthy}">
3    True
4    <aura:set attribute="else">
5      False
6    </aura:set>
7  </aura:if>
8</aura:component>

Attributes 

NameDescriptionTypeDefaultRequired
bodyThe components to render when isTrue evaluates to true.Aura.ComponentDefRef[]
elseThe alternative to render when isTrue evaluates to false, and the body is not rendered. Should always be set using the aura:set tag.Aura.ComponentDefRef[]
isTrueAn expression that must be fulfilled in order to display the body.Boolean