Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

lightning:tabCreated

Indicates that a tab has been created successfully.

Response

Name Type Description
tabId string The ID of the new tab.

Example

This example prints a line to the browser’s developer console when a tab is created, and sets the label of the tab to "New Tab" using the setTabLabel() method.

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:workspaceAPI aura:id="workspace" />	
3    <aura:handler event="lightning:tabCreated" action="{! c.onTabCreated }"/> 
4</aura:component>

Controller code:

1({
2    onTabCreated : function(component, event, helper) {
3        console.log("Tab created.");
4        var newTabId = event.getParam('tabId');
5        var workspaceAPI = component.find("workspace");
6        workspaceAPI.setTabLabel({
7            tabId: newTabId,
8            label: 'New Tab'
9        });
10    }, 
11})