Newer Version Available

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

setUtilityLabel() for Lightning Experience

Sets the label of the current utility. This text is displayed in the utility bar.

Arguments

Name Type Description
label string The label of the utility. This is displayed in the utility bar.

Sample Code

This component, when added to a single-column Lightning page used in a utility bar, sets the label of the utility to “My Favorite Utility” when the button is pressed.

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <force:utilityBarAPIAccess aura:id="utilitybar" />
3    <lightning:button label="Set Utility Label" onclick="{! c.setUtilityLabel }"/>
4</aura:component>

Controller code:

1({
2    setUtilityLabel : function(component, event, helper) {
3        var utilityAPI = component.find("utilitybar"); 
4        utilityAPI.setUtilityLabel("My Favorite Utility");
5    }
6})

Response

None.