Skip to main content
Retrieves a reference to a writeable element container where custom HTML content can be injected into specific locations within the chat interface. Use this method to add custom notifications, images, carousels, banners, and other interactive content to enhance the chat experience.

Syntax

Parameters

elementName
string
required
The name of the writeable element location. Must be one of the available writeable element names.

Available writeable element locations

chatWelcomeComponent
The chatWelcomeComponent location overlays the main chat area. When content is added to this element:
  • A CSS class has-center-chat-component is automatically added to the document body.
  • The class is removed when the element is empty.
  • Use this location sparingly as it obscures the main chat interface.
  • Use for loading screens, full-screen notifications, or modal-like content.
aiTooltipAfterDescription
This location appears within the AI disclaimer tooltip and has limited space. Keep content minimal and relevant to AI usage disclaimers.

Returns

HTMLDivElement
Returns an HTMLDivElement reference that can be used to inject custom HTML content.

Examples

The following example shows how to add a notification banner below the header:
The following example demonstrates adding a custom image carousel above the input bar:
The following example demonstrates adding interactive buttons with click handlers:
The following example demonstrates adding content with scrollable overflow:
The following example shows how to add custom content to the AI disclaimer tooltip:
The following example demonstrates using the center chat component for a loading screen:
The following example demonstrates clearing writeable element content:

Considerations

Required CSS classes for styling

To override the default chat styles, make sure your CSS selector includes the WxO container classes. For example:
This is required because the chat implements CSS reset to prevent host page styles from affecting the chat interface.

Layout support

Writeable elements are available for the following layout forms:
  • Floating (float)
  • Custom (custom)
  • Fullscreen (fullscreen-overlay)

Content size and layout

The chat does not impose specific size limits on writeable element content. However, large amounts of content might create undesirable layouts. Consider the following practices:
  • Use max-height with overflow: auto for scrollable content.
  • Test your content across different screen sizes.
  • Avoid content that significantly increases the chat height.
  • Consider using responsive design techniques.

Timing and initialization

Do not call getWriteableElement() before the chat instance is initialized. The method requires an active instance and fail if called before the onLoad callback fires.

Do you need practical examples?

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