Newer Version Available

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

setUtilityIcon() for Lightning Experience

Sets the icon of a utility. This icon is displayed in the utility bar.

Arguments

Name Type Description
utilityId string The ID of the utility on which to set the icon. Optional when called within a utility.
icon string An SLDS utility icon key that is displayed in the utility bar. See a full list of utility icon keys on the SLDS reference site.

Sample Code

This component, when added to a single-column Lightning page used in a utility bar, sets the icon of the utility to the SLDS “insert_tag_field” icon when the button is pressed.

Component code:

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

Controller code:

1({
2    setUtilityIcon : function(component, event, helper) {
3        var utilityAPI = component.find("utilitybar");
4        utilityAPI.setUtilityIcon({
5            icon:insert_tag_field
6        });
7    }
8})

Response

This method returns a promise that, upon success, resolves to true.