Newer Version Available

This content describes an older version of this product. View Latest

minimize() for Lightning Experience

Minimizes a utility. This method is available for Lightning Web Components (LWC) only.

Arguments

Name Type Description
utilityId string The ID of the utility for which to minimize.

LWC Sample Code

This component minimizes a utility.

1import { LightningElement, wire } from 'lwc';
2import { minimize, EnclosingUtilityId } from 'lightning/platformUtilityBarApi';
3
4export default class MinimizeUtilityExample extends LightningElement {
5    @wire(EnclosingUtilityId) utilityId;
6    
7    async handleMinimize() {
8        try {
9            if (!this.utilityId) {
10                return;
11          }
12        // Minimize the utility bar panel
13        const isMinimized = await minimize(this.utilityId);
14        console.log(`Minimize utility ${isMinimized ? 'successfully' : 'failed'}`);
15        }
16        catch (error) {
17            // handle error
18        }
19    }
20}

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.