Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

setUtilityIcon() for Lightning Experience

Sets the icon of a utility. This icon is displayed in the utility bar. This method isn’t supported for Lightning Web Components (LWC).

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.
options object Optional. Additional options that modify the appearance of the utility icon.
  • iconVariant—Changes the utility icon color. Available types are success (green success color), warning (yellow warning color), and error (red error color).

Aura Components Sample Code

This component, when added to a single-column Lightning page used in a utility bar, sets the icon of the utility to a green 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.handleSetUtilityIcon }" />
4</aura:component>

Controller code:

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

Response

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