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:

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

Controller code:

({
    onTabCreated : function(component, event, helper) {
        console.log("Tab created.");
        var newTabId = event.getParam('tabId');
        var workspaceAPI = component.find("workspace");
        workspaceAPI.setTabLabel({
            tabId: newTabId,
            label: 'New Tab'
        });
    }, 
})