setTabHighlighted() for Lightning Experience
Highlights the specified tab with a different background color and a badge. Tab highlights don’t persist after reloading a Lightning console app. This method works only in Lightning console apps.
| Name | Type | Description |
|---|---|---|
tabId | string | The ID of the tab to be highlighted. |
highlighted | boolean | Whether the tab is highlighted. Makes a utility more prominent by giving it a different background color. |
options | object | Optional. Additional options that modify the appearance of the highlighted tab. Available options are:
|
This component checks if it’s in a Lightning console app, returns information about the focused tab and highlights it in green.
This example is the workspaceAPIHighlightTab component from the lwc-recipes repo.
To make your component available for use in a Lightning console app, specify the lightning__AppPage target in the component’s configuration file.
This component has a button that, when pressed, sets the focused tab as highlighted.
Component code:
Controller code:
This method returns a promise that, upon success, 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.
),
), and
).