Skip to main content
Language

Interacting with Panels

Panels are a basic concept of our UI, e.g. extensively used for asset libraries and inspectors. Given a CreativeEditorSDK instance, we can query if a given panel is open as well as access methods to open/close them.

  • cesdk.ui.isPanelOpen(panelId: string, options?: { position?: PanelPosition, floating?: boolean }): boolean returns true if a panel with the given panel id is open. If options are provided they will be matched against the panel's options. E.g. isPanelOpen('//ly.img.panel/assetLibrary', { floating: false }) will only return true if the asset library is open as a floating panel.
  • cesdk.ui.openPanel(panelId: string, options?: { position?: PanelPosition, floating?: boolean }) opens a panel with the given id if and only if it exists, is not open and is currently registered (known to the UI). Otherwise the method does nothing and is a noop. Options can be provided additionally that will override the default position and floating of the given panel. Please note, that the default position and floating behavior are not changed for this panel.
  • cesdk.ui.closePanel(panelId: string) closes a panel with the given id if and only if it exists and is open. Otherwise the method does nothing and is a noop.

Panel Position#

Every panel in the UI is typically displayed either on the left or right side of the canvas. An exception exists for rendering in smaller viewports, where all panels are situated at the bottom.

The setPanelPosition API is used to determine a panel's default placement.

  • cesdk.ui.setPanelPosition(panelId: string, panelPosition: PanelPosition) assigns a specific position to a panel identified by panelId. This function will also alter the panel's position while it is open, provided the panel wasn't initially opened with a pre-defined position option (see above).

Floating Panel#

Panels can either float over the canvas, potentially obscuring content, or be positioned adjacent to the canvas. The setPanelFloating API allows you to modify this behavior to suit different use cases.

  • cesdk.ui.setPanelFloating(panelId: string, floating: boolean) when set to true, the specified panel will float above the canvas. Conversely, setting it to false places the panel beside the canvas.

Available Panels#

Currently we support the following panel ids.

Panel IdDescription
Panel Id
//ly.img.panel/inspector
Description
The inspector panel for the currently selected block. Please note, that if no block is selected at all, this will open an empty panel with no content. In the advanced view, inspector panels are always open and cannot be opened/closed.
Panel Id
//ly.img.panel/assetLibrary
Description
The panel for the asset library, Please note, that currently it is ot possible to open a new asset library with library entries defined. Thus, opening an asset library would show an empty library. More useful is closePanel to close an already open asset library.
Panel Id
//ly.img.panel/assetLibrary.replace
Description
The panel containing the replace library for the currently selected block. Please note, that if no block is selected or the selected block does not have asset replacement configured, the opened library will be empty. See Custom Asset Library for more information.
Panel Id
//ly.img.panel/settings
Description
The settings panel to customize the editor during runtime.