Newer Version Available

This content describes an older version of this product. View Latest

setTabIcon() for Lightning Experience

Sets the icon and alternative text of the specified tab.

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.
callback function JavaScript method called upon completion of the method. Returns a tabInfo object containing information about the modified tab.

Sample Code

This component has a button that, when pressed, opens a tab and sets the tab’s icon to the SLDS emoji icon.

Component code:

Controller code:

The relative URL used in this example is a placeholder. To try this example yourself, use a relative URL with a record ID from your org.

Note

Response

This method is asynchronous, and returns 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.