open() for Lightning Experience

Opens a utility. If the utility is already open, this method has no effect. Only one utility can be open at a time. If another utility is already open, open() minimizes the utility. This method is available for Lightning Web Components (LWC) only.

Arguments 

Optional parameters are passed into an object as the last argument of the method.

NameTypeDescription
utilityIdstringThe ID of the utility to open.
autoFocusobjectOptional. Specifies whether the utility item to open has focus.

LWC Sample Code 

This component opens a utility using the enclosing utility ID.

1import { LightningElement, wire } from 'lwc';
2import { open, EnclosingUtilityId } from 'lightning/platformUtilityBarApi';
3
4export default class EnablePopoutExample extends LightningElement {
5    @wire(EnclosingUtilityId) utilityId;
6
7    async handleOpen() {
8        if (!this.utilityId) {
9            return;
10        }
11        await open(this.utilityId, { autoFocus: true });
12    }
13}

To make your component available for use in a utility bar, specify the lightning__UtilityBar target in the component’s configuration file.

Response 

Returns a promise that resolves to true if successful. The promise is rejected on error.