setActivePanel
Change the active panel.
Overview
Use setActivePanel to programmatically switch the active panel. When the SDK's focus management is active, it also moves focus to the corresponding panel navigation button. When focus management is paused, the focus update is deferred until focus management resumes.
Method Signature
setActivePanel(panelType: MaestroPanelType, panelId?: string): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
panelType | MaestroPanelType | The panel type to activate. |
panelId | string | Optional. The config _id of the specific panel instance to activate. Required when the page config contains multiple panels of the same type (for example, two builder panels); omit for single-instance panel types. |
Example Usage
import SDK, { MaestroPanelType } from "@maestro_io/maestro-web-sdk";
// Activate a single-instance panel by type.
function showHelloWorldPanel() {
const event = SDK.getMaestroEventViewModel();
event.setActivePanel(MaestroPanelType.HELLO_WORLD);
}
// Activate a specific instance when multiple panels share the same type.
function showBuilderPanel(panelId: string) {
const event = SDK.getMaestroEventViewModel();
event.setActivePanel(MaestroPanelType.BUILDER_BLOCK_PANEL, panelId);
}