(this page was created automatically. In case of formatting issues, please visit the official Wiki Page)

Chat

Overview

  • The DynamicChatComponent (Chat) is an interactive chat interface for dynamic applications.
  • It supports messages with type (user or bot), content, and timestamp.
  • The components provide configurable bot message rating icons with tooltips, click behavior, and alternate icons.
  • It uses event-driven actions for sending messages, handling content clicks, and rating icon clicks.
  • The components include properties for testing and authorization configuration.

Example Chat

Specs

Tokens

Token Description
id Unique identifier for the component.
displayName Display name in the structure panel.
botMessageRatingIcons Icons used to rate bot messages.
name Icon identifier within botMessageRatingIcons.
tooltipTranslations Localized tooltip text map.
alternateIcon Alternate icon for toggling state.
isClickableOnce Limits an icon to a single click.
events List of event actions (component and icon).
ON_INIT (Events) Fires on component initialization.
ON_DESTROY (Events) Fires when component is removed.
ON_GLOBAL_PARAMETERS_CHANGE (events) Fires when relevant global parameters change.
ON_DATA_HUB_CHANGE (events) Fires when the Data Hub context/state changes.
ON_SEND_MESSAGE (Events) Triggered when a user sends a message.
ON_CONTENT_CLICK (Events) Triggered on content click within a message.
ON_ICON_CLICK (Events) Triggered when a rating icon is clicked.
maxMessageLength Max characters allowed in user input.
paddingClass CSS padding classes for the component.
visibilityPolicySetId Policy set controlling component visibility.
dataTestId Identifier used for automated testing.

Structure

  • The component manages an array of chat messages and defines actions the user can trigger.

(Configured in General Properties)

  • displayName — Sets the display name of the component, shown in the structure panel for easy identification.
  • id — Specifies the unique identifier for the component. Used for referencing and programmatic access.

(Configured in Data Documentation)

  • The component manages an array of chat messages, each with properties such as type (user or bot), content, and timestamp.
  • Example message:
  {
    "type": "user",
    "question": "How can I reset my password?",
    "timestamp": 1697800000000
  }

[IMAGE PLACEHOLDER: High-level structure showing displayName/id and the message array]

Styling

(Configured in Visual Properties)

  • botMessageRatingIcons — Configures the set of icons displayed for rating bot messages. Each icon can have its own tooltip, click behavior, and alternate icon for toggling.
    Example:
  [
    {
      "name": "thumbs-up",
      "tooltipTranslations": { "en-US": "Helpful", "de-DE": "Hilfreich" },
      "alternateIcon": "thumbs-up-filled",
      "isClickableOnce": true,
      "events": [/* ... */]
    }
  ]
  • maxMessageLength — Sets the maximum number of characters allowed in a user message. Controls input length and prevents excessively long messages.
  • paddingClass — Configures the padding for the chat component using CSS classes.

Actions

(Configured in Event Actions)

  • events — Defines the list of event actions the component can trigger. These events allow integration with dynamic actions, such as sending messages or handling content clicks.
    Example:
  [
    { "type": "ON_SEND_MESSAGE", "actions": [/* ... */] },
    { "type": "ON_CONTENT_CLICK", "actions": [/* ... */] }
  ]
    ```
    - **ON_INIT** – Triggered when the label component is initialized. Can be used to perform setup operations like setting initial context values.
    - **ON_DESTROY** – Triggered when the label component is removed from the DOM. Useful for cleanup operations and releasing resources.
    - **ON_GLOBAL_PARAMETERS_CHANGE** – Triggered when global parameters that might affect the component change.
    - **ON_DATA_HUB_CHANGE** - Emitted whenever the Data Hub’s active context or state changes.
    - **ON_SEND_MESSAGE** — Triggered when a user sends a message. Can be used to invoke backend APIs or trigger workflows.
    - **ON_CONTENT_CLICK** — Triggered when a user clicks on content within a message. Useful for handling links or interactive elements.
    - **ON_ICON_CLICK** — Triggered when a bot message rating icon is clicked. Allows for custom feedback handling or analytics.

### Tests
*(Configured in Testing Hooks)*
- **dataTestId** — Sets the testing hook ID for automated testing. Makes it easier to select the component in end-to-end or unit tests.  
  Example: `"support-chat-component"`

### Authorization
*(Configured in Authorization)*
- **visibilityPolicySetId** — Determines the visibility of the component based on a policy set. Restricts access to certain users or roles.  
  Example: `"supportAgentsOnly"`

### Links
- Figma: tba
- Live style guide: tba

## Guidelines

### Example Configuration

json { "id": "supportChat", "displayName": "Support Chat", "botMessageRatingIcons": [ { "name": "thumbs-up", "tooltipTranslations": { "en-US": "Helpful" }, "alternateIcon": "thumbs-up-filled", "isClickableOnce": true, "events": [{ "type": "ON_ICON_CLICK", "actions": [] }] } ], "maxMessageLength": 500, "events": [ { "type": "ON_SEND_MESSAGE", "actions": [] }, { "type": "ON_CONTENT_CLICK", "actions": [] } ], "dataTestId": "support-chat-component" } ```

Usage

  • Use Chat for conversational interactions where users submit text and receive bot responses, and you need event hooks to process them.
  • Collect immediate feedback on bot replies with a small, meaningful set of rating actions.
  • Prevent runaway input and keep responses snappy by limiting user message length.
  • Make the component easy to target in tests and telemetry.
  • Keep authoring clear in complex boards by labeling the instance.

Sizing & Layout

  • Adjust in-component whitespace without external CSS.
  • Keep rating affordances compact—offer only the essential icons.
  • Favor stable layouts when a rating is recorded—swap icons without shifting content.

States & Feedback

  • Show selection/acknowledgement after a rating is made by toggling the icon.
  • Prevent multiple ratings on the same message when appropriate.
  • Execute side effects (e.g., analytics, persistence) directly from rating interactions.
  • Initialize and tear down cleanly.

Tooltips

  • Provide clear, localized hints for each rating icon; keep microcopy short and action-oriented.
  • Tooltips are supplemental only—don’t rely on them for critical information.

Interactions & Events

  • Send messages through the dedicated event and attach your action chain there.
  • Make message content interactive (e.g., link taps) by handling content clicks.
  • React to ambient context changes that should affect the chat experience.
  • Free resources/listeners when the component is removed.

Data-Driven / Conditional Behavior

  • Represent “rated” vs “not rated” using visual swaps rather than color alone.
  • Gate which icons are present based on current context by rebuilding the icon list when inputs change.

Visibility & Authorization

  • Hide the entire chat for disallowed audiences.

Content & Localization

  • Localize all rating affordance texts; keep them concise.
  • Distinguish authoring labels from end-user text.

Dos & Don’ts

Do Don’t Article setting(s)
Limit user input to an appropriate maximum (e.g., to keep latency down). Allow unbounded message length that slows or breaks processing. maxMessageLength
Offer only the key rating choices (e.g., up/down). Present a cluttered row of many nuanced reaction icons. botMessageRatingIcons[], botMessageRatingIcons[].name
Show a clear “rated” state by swapping to the alternate icon. Change only color to indicate rating. botMessageRatingIcons[].alternateIcon
Prevent repeat ratings when they would skew analytics. Let users toggle the same rating repeatedly. botMessageRatingIcons[].isClickableOnce
Localize each rating tooltip with short, action-oriented text. Leave tooltips in a single language or overly long. botMessageRatingIcons[].tooltipTranslations
Wire rating interactions to your handler chain. Leave icons inert (no action on click). events, ON_ICON_CLICK
Handle taps on links or interactive message content. Ignore message content clicks and rely on default browser behavior. events, ON_CONTENT_CLICK
Add spacing with the built-in padding token for readability. Depend on external wrappers to fix spacing. paddingClass
Hide the chat when access isn’t permitted. Show the chat and attempt to block usage via content alone. visibilityPolicySetId

Accessibility

  • Convey state without color reliance by swapping to an alternate icon. (botMessageRatingIcons[].alternateIcon)
  • Provide localized text for rating affordances. (botMessageRatingIcons[].tooltipTranslations)
  • Cap input length to reduce cognitive load and prevent overflow. (maxMessageLength)
  • Avoid exposing functionality to unauthorized users. (visibilityPolicySetId)
  • No labels