Skip to main content
The customPanels namespace provides methods for creating and controlling a custom panel overlay within the embedded chat interface. A custom panel is a full-size overlay that you can populate with arbitrary HTML content — such as login forms, terms and conditions screens, file download widgets, or any other custom UI element — without closing or replacing the chat. Only one custom panel instance can be active at a time. To display different content, update the hostElement of the existing panel and call open() again rather than creating a new panel. Custom panels are available only in embedded chat. They are not supported in standalone mode.

Methods

Properties


getPanel()

Returns the single custom panel instance. Because only one panel can exist at a time, calling getPanel() always returns the same object. Obtain this reference before calling open() or close().

Syntax

Returns

Returns the custom panel object. Use the returned object to call open(), close(), and access hostElement.

open(config)

Opens the custom panel and configures its header. Call this method after populating the panel’s hostElement with the content you want to display. You can call open() at any point in the conversation lifecycle: before the first user message, during a conversation, or in response to a tool result.

Syntax

Parameters

object
Optional configuration object for the panel header. All properties are optional.

config properties

string
The title displayed in the panel header. Inherits the font family configured for the embedded chat.
  • Default: No title is shown.
boolean
When true, hides the Back button in the panel header. The Back button returns the user to the previous panel view when clicked.
  • Default: false (Back button is shown).
boolean
When true, hides the Close button in the panel header. The Close button minimizes the entire chat window.
  • Default: false (Close button is shown).
This property is ignored if hideCloseButton is set to true at the top-level chat configuration.
boolean
When true, hides the entire panel header bar, including the title and all buttons.
  • Default: false (header is shown).

Returns

Returns void.

close()

Closes the currently open custom panel and removes it from the chat view. The chat returns to the previous view.

Syntax

Returns

Returns void.

hostElement

The HTMLDivElement where you inject the content to display inside the custom panel. Set the innerHTML of this element before calling open().

Type

A writable DOM element. Set innerHTML or append child elements to populate the panel.

Examples

Basic custom panel

The following example opens a custom panel with a title and a simple message:

Panel without a header

The following example opens a custom panel with the header hidden:

Replacing panel content without closing

Because only one panel instance exists at a time, update the hostElement and call open() again to display different content in the same panel:

Opening a panel in response to a tool result

The following example opens a custom panel when the agent returns a specific response type:

Closing a panel programmatically

The following example closes the panel when a button inside the panel is clicked:

Considerations

Single panel instance

Only one custom panel instance can exist at a time. Calling getPanel() always returns the same object. If you want to display different content, update hostElement and call open() again. The chat does not manage multiple panel instances.

Panel sizing

The custom panel fills the entire chat window by default.

Header color

The panel header uses the same background color as the main embedded chat header. This is configured in the chat settings and cannot be changed per-panel.

Timing

Do not call customPanels.getPanel() before the chat instance initializes. Always access the panel inside the onLoad callback or after the chat:ready event fires.

Layout support

Custom panels are supported in the following embedded chat layouts:
  • ✅ Floating
  • ✅ Custom (including side panel)
  • ✅ Fullscreen
  • ❌ Standalone (not supported)

Do you need practical examples?

Learn how to apply the features available for embedded chat into your implementation with guidance and examples.