setPanelWidth() for Lightning Experience

Sets a utility panel’s width. This method isn’t supported for Lightning Web Components (LWC).

For LWC usage, see updatePanel().

Arguments 

NameTypeDescription
utilityIdstringThe ID of the utility of which to set the width. Optional when called within a utility.
widthPXintegerThe width of the utility panel in pixels.

Aura Components Sample Code 

This component, when added to a single-column Lightning page used in a utility bar, sets the width of the utility panel to 800 pixels 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 Panel Width" onclick="{! c.handleSetPanelWidth }" />
4</aura:component>

Controller code:

1({
2    handleSetPanelWidth : function(component, event, helper) {
3        var utilityAPI = component.find("utilitybar");
4        utilityAPI.setPanelWidth({
5            widthPX: 800
6        });
7    }
8})

Response 

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