Newer Version Available
setTabIcon() for Lightning Experience
Sets the icon and alternative text of the specified tab. This method works only in
Lightning console apps.
Arguments
| Name | Type | Description |
|---|---|---|
| tabId | string | The ID of the tab for which to set the icon. |
| icon | string | An SLDS icon key. See a full list of icon keys on the SLDS reference site. |
| iconAlt | string | Optional. Alternative text for the icon. |
Sample Code
This component has a button that, when pressed, sets the icon of the focused tab to the SLDS “Approval” action icon.
Component code:
Controller code:
Response
This method returns a promise that, upon success, resolves to a
tabInfo object representing the modified tab. A
tabInfo object is a JSON array of
information about a workspace tab, with nested arrays of information on each subtab.
This is the structure of a tabInfo
object.