Newer Version Available
setUtilityIcon() for Lightning Experience
Sets the icon of the current utility. This icon is displayed in the utility
bar.
Arguments
| Name | Type | Description |
|---|---|---|
| sldskey | string | An SLDS utility icon key. This will be 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 <force:utilityBarAPIAccess 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('insert_tag_field');
5 }
6})Response
None.