Tab Created

lightning:tabCreated

Fires when a Console workspace or subtab has been successfully created.

For Use In

Lightning Experience

::::::tabset{tabs='[ "Develop", "Specifications"]'}

:::::tab

lightning:tabCreated is an application event that indicates a tab has been created successfully. This event is supported in Lightning console apps only.

Handle the event using aura:handler.

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

In your client-side controller, retrieve the ID of the new tab and set a label on the tab.

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

For more information, see the Salesforce Console Developer Guide.

:::::

:::::tab

Attributes

Name Description Type Default Required
tabId The newly created tab ID. string Yes

:::::

::::::