A single tab that is nested in a lightning:tabset component.
For Aura components only. For LWC development, use lightning-tab.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
A lightning:tab component keeps related content in a single container. The tab content displays when a user clicks the tab. Use lightning:tab as a child of the lightning:tabset component.
This component implements styling from tabs in the Lightning Design System.
Use the label attribute to specify the tab’s text label.
To include an icon at the beginning of the label, use the iconName attribute. Provide alternative text for the icon using the iconAssistiveText attribute.
To include an icon at the end of the label, use the endIconName attribute. Provide alternative text for that icon using the endIconAlternativeText attribute.
Set showErrorIndicator to true to display an error indicator in the tab after the label. If an end icon is present, the error indicator is displayed after the icon.
Usage Considerations
Tab content is lazy loaded. You can only query the content for the active and previously active tabs. See lightning:tabset for more information.
You can nest lightning:tab within aura:if or aura:iteration. Otherwise, you must nest lightning:tab directly within lightning:tabset.
For example, you want to display a tab conditionally.
Specifies a shortcut key to activate or focus an element.
String
body
The body of the tab.
Aura.ComponentDefRef[]
endIconAlternativeText
Alternative text for the icon specified by endIconName.
String
endIconName
The Lightning Design System name of an icon to display at the end of the tab label. Specify the name in the format 'utility:check' where 'utility' is the category, and 'check' is the icon to be displayed.
String
iconAssistiveText
Alternative text for the icon specified by iconName.
String
iconName
The Lightning Design System name of an icon to display at the start of the tab label. Specify the name in the format 'utility:down' where 'utility' is the category, and 'down' is the icon to be displayed. Only utility icons can be used in this component.
String
id
The optional ID is used during tabset's onselect event to determine which tab was clicked.
String
label
The text that appears on the tab. The attribute accepts string values, but for compatibility with previous releases also accepts a component type. Only the text portion of the label value displays and any CSS classes that are applied are ignored.
Aura.Component[]
onactive
The action triggered when this tab becomes active.
Aura.Action
onblur
The action triggered when the element releases focus.
Aura.Action
onfocus
The action triggered when the element receives focus.
Aura.Action
showErrorIndicator
Specifies whether there's an error in the tab content. An error icon is displayed to the right of the tab label.
Boolean
tabindex
Specifies the tab order of an element when the Tab key is used for navigating. The tabindex value can be set to 0 or -1. The default is 0, which means that the component is focusable and participates in sequential keyboard navigation. -1 means that the component is focusable but does not participate in keyboard navigation.