ZUI

Search documentation

Find a page or a heading.

Chat message

One chat message row over Message, with a line beside its leading edge while its text is still streaming.

Installation

bash

The CLI writes components/data-display/chat-message.tsx, installs Direction, Message and Utils.

Usage

tsx

Compose the row from Message's parts, and add a ChatMessageAccent while the row streams:

tsx

Use it to mark a row as still streaming; a static row needs only Message.

Composition

text

API reference

ChatMessage

Takes every prop of Message, plus:

ChatMessageAccent

Takes every prop of React Native's View. The line 12px before the row's leading edge, drawn only while the row streams and hidden from a screen reader. It is painted in the primary colour, or in the colour a className or style gives it, such as the agent's. It sits outside the row, so the list around the row needs room there.

Differences from the web

  • The accent takes its colour from its own className or style; the web reads a --chat-message-accent CSS variable set on the row, which neither engine passes from a parent's style to a child.
  • The accent is not rendered while the row is not streaming; the web keeps it in the page and hides it by a group selector.
  • The web's data-slot and data-streaming attributes are not set; a View takes no data attributes.