Newer Version Available
toggleModalMode() for Lightning Experience
Toggles modal mode for a utility. While in modal mode, an overlay blocks users from
using the console while the utility panel is visible.
Arguments
| Name | Type | Description |
|---|---|---|
| utilityId | string | The ID of the utlity to open. Optional when called within a utility. |
| enableModalMode | boolean | Whether to enable modal mode. |
Sample Code
This component, when added to a single-column Lightning page used in a utility bar, has a button that, when pressed, toggles modal mode.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <lightning:utilityBarAPI aura:id="utilitybar" />
3 <lightning:button label="Toggle Modal Mode" onclick="{! c.toggleModalMode }" />
4</aura:component>Controller code:
1({
2 toggleModalMode : function(component, event, helper) {
3 var utilityAPI = component.find("utilitybar");
4 utilityAPI.toggleModalMode({
5 enableModalMode: true
6 });
7 }
8})Response
This method returns a promise that, upon success, resolves to true.