How to change the tab label in Lightning Component

Lightning Components Tutorial

Are you working with Lightning Component (Aura) tab functionality?

Need to change your Tab label and Icon based on business logic?

Cool !!!

Now it’s not a big deal, we can do this kind of changes using WorkspaceAPI.

Let’s get started with the coding to change the label.


<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />
    <lightning:button label="Set Focused Tab with Label" onclick="{! c.setFocusedTabLabel }" />


    setFocusedTabLabel : function(component, event, helper) {
        var workspaceAPI = component.find("workspace");
        workspaceAPI.getFocusedTabInfo().then(function(response) {
            var focusedTabId = response.tabId;
                tabId: focusedTabId,
                label: "Focused Tab"
        .catch(function(error) {

The wait is over check your UI, Now your label will be Focused Tab 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *