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.

Name Type Description
utilityId string The ID of the utility to open.
autoFocus object Optional. Specifies whether the utility item to open has focus.

LWC Sample Code

Before you can use the LWC utility bar API, Lightning Web Security must be enabled.

This component opens a utility using the enclosing utility ID.

import { LightningElement, wire } from 'lwc';
import { open, EnclosingUtilityId } from 'lightning/platformUtilityBarApi';

export default class EnablePopoutExample extends LightningElement {
    @wire(EnclosingUtilityId) utilityId;

    async handleOpen() {
        if (!this.utilityId) {
            return;
        }
        await open(this.utilityId, { autoFocus: true });
    }
}

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.