Platform Workspace API

lightning/platformWorkspaceApi

Work with workspace tabs and subtabs in a Lightning console app using the lightning/platformWorkspaceApi module. The lightning/platformWorkspaceApi module requires API version 59.0 or later.

For Use In

Lightning Experience

The lightning/platformWorkspaceApi module provides LWC Workspace API methods to control workspace tabs and subtabs in a Lightning console app. All the methods in the lightning/platformWorkspaceApi module return a promise. Required method parameters are explicitly passed as individual arguments. Optional parameters are passed into an object as the last argument of the method.

To use the Workspace API in your component, import the functions in your component's JavaScript file.

import {
  EnclosingTabId,
  IsConsoleNavigation,
  closeTab,
  disableTabClose,
  focusTab,
  getAllTabInfo,
  getFocusedTabInfo,
  getTabInfo,
  openSubtab,
  openTab,
  refreshTab,
  setTabHighlighted,
  setTabIcon,
  setTabLabel,
} from "lightning/platformWorkspaceApi";

The following example toggles the highlight of a focused tab in the Lightning console app.

// c/myComponent.js
import { LightningElement, wire } from "lwc";
import {
  IsConsoleNavigation,
  getFocusedTabInfo,
  setTabHighlighted,
} from "lightning/platformWorkspaceApi";

export default class MyComponent extends LightningElement {
  @wire(IsConsoleNavigation) isConsoleNavigation;

  onToggleHighlightTab(event) {
    if (!this.isConsoleNavigation) {
      return;
    }
    const { highlighted } = event.detail;
    getFocusedTabInfo().then((tabInfo) => {
      const { tabId } = tabInfo;
      setTabHighlighted(tabId, highlighted, {
        pulse: true,
        state: "success",
      });
    });
  }
}

For this module's documentation, see Methods for Workspace Tabs and Subtabs in Lightning Experience in the Console Developer Guide.

To work with Lightning console app events in your component, subscribe to the Lightning message channels for the Aura application events that you want to listen for.

error fallback image
No specifications to show
No specifications are available for this component or API module. When specifications are defined, they'll appear here.

Welcome to the new Lightning Component Reference!

Beginning November 2025, all base component doc updates are here. The Winter ’26 content in the legacy Component Reference won’t be updated further. The legacy site will redirect here for Spring ’26.