Newer Version Available

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

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})