Skip to content
Twentyfirst UIPro

Chat Thread

AI · ChatThread, DaySeparator, HandoffLine, SystemLine, VoiceLog, VoiceNote, TypingIndicator, ReadOnlyBar, ChatMessage

View as Markdown

The conversation itself and the lines between its messages.

ChatThread: the scrolling log of a conversation. children (messages and lines), jumpTo (a message id: scrolls to it and marks it, e.g. from SearchHits), jumpKey (to jump to the same one again), stickToBottom (default true: follows the newest message while it streams, unless the reader scrolled up; then a button jumps to the latest), label.

  • DaySeparator: "Today", "Yesterday" or the date between days; with label="New messages" and tone="accent" above the first unread message.
  • HandoffLine: one agent passes the work to another: from, to ({name, tint, kind, avatar}), reason, time, href / onClick to open their conversation.
  • SystemLine: what happened around the messages (a model switch, a pause): icon, time, tone ("warning", "danger").
  • VoiceNote: a voice message: play, seek, length and the transcript behind "Show transcript". src, duration (seconds), transcript, peaks, mine.
  • VoiceLog: a finished voice conversation folded into one line: duration, time, turns, audio (the recording, if it was kept).
  • TypingIndicator: "Lena is typing…", "Lena and Noah are typing…", "3 people are typing…".
  • ReadOnlyBar: in place of the composer while you read along an agent-to-agent conversation, with "Step in".
Ledger17:03

Prorated April is €480 for 40 seats. Billed with the next invoice.

Atlas paused until the quote is approved
0:14
Sending the quote needs an approval
Atlas and Lena Hart are typing…
You are reading along: Atlas and Ledger

Props

ChatThread

PropTypeNotes
children?ReactNode
jumpTo?stringScrolls to the message with this `id` (a search hit) and marks it for a moment.
jumpKey?string | numberChange it to jump to the same message again.
stickToBottom?booleanFollows the newest message while it grows, unless the reader scrolled up (default true).
label?stringAccessible name (default "Conversation").
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

DaySeparator

PropTypeNotes
date?Date | string | numberThe day: shows "Today", "Yesterday" or the weekday and date in the provider's locale.
label?stringText instead of the date (e.g. "New messages").
tone?"neutral" | "accent""accent" for the "new messages" line (the signal colour).
now?Date | string | numberWhat counts as today (default now), for stable tests and server rendering.
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

HandoffLine

PropTypeNotes
fromHandoffPartyWho hands the work over.
toHandoffPartyWho takes it.
reason?ReactNodeWhy, in a few words.
time?string
id?string
href?stringOpens the conversation between the two.
onClick?() => void
linkAs?ElementType
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

SystemLine

PropTypeNotes
children?ReactNode
icon?IconName
time?string
id?string
tone?"neutral" | "warning" | "danger"
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

VoiceLog

PropTypeNotes
title?stringDefault "Voice conversation".
duration?stringLength as shown ("4:12").
time?string
turnsVoiceTurn[]Required
audio?stringThe recording, if it was kept.
audioDuration?number
id?string
open?boolean
defaultOpen?boolean
onOpenChange?(open: boolean) => void
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

VoiceNote

PropTypeNotes
src?stringThe recording (any URL the browser can play).
duration?numberLength in seconds (default: read from the file).
transcript?ReactNodeThe words, behind "Show transcript".
transcriptOpen?boolean
onTranscriptOpenChange?(open: boolean) => void
peaks?number[]Loudness per moment, 0 to 1, for the bars (default: a steady pattern).
mine?booleanDrawn as the user's own (on the primary colour).
label?string
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

TypingIndicator

PropTypeNotes
namesstring[]Who is typing (renders nothing when empty).
text?stringYour own text instead of "Lena is typing…".
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

ReadOnlyBar

PropTypeNotes
text?stringDefault "You are reading along".
actionLabel?stringDefault "Step in".
onAction?() => void
children?ReactNode
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

ChatMessage

PropTypeNotes
role"user" | "assistant" | "system"Required
id?stringStable id: `ChatThread jumpTo` scrolls to it (rendered as `data-message-id`).
name?string
time?string
model?string
text?string
streaming?boolean
tint?Tint
icon?IconNameIcon of a system line.
sources?Source[]
attachments?ChatAttachment[]Images show as thumbnails, other files as chips with a download link.
mentions?Mention[]Mentions in a user's `text` (from `Composer`), drawn as tinted chips.
highlight?stringMarks the words of a search in the text.
voice?{ src?: string; duration?: number; transcript?: ReactNode; peaks?: number[] }A voice message instead of text: the player, its length and the transcript.
dictated?boolean"Dictated" under the message.
inVoice?boolean"In voice conversation" under the message.
usage?string
onRetry?() => voidRegenerate: pass it on the last answer only.
onFeedback?(v: "up" | "down" | null) => voidThumbs up or down (null when the reader takes it back).
onFeedbackComment?(v: "up" | "down", comment?: string) => voidThe comment after thumbs down (an empty comment for thumbs up).
actions?boolean`false` hides the action row; the rest of the props pick which actions show.
actionsVisible?"always" | "hover"When the action row shows: "always", or "hover" (on hover and focus; always on touch screens). Default "always" for an answer with `onRetry` (the last one) and for a message with versions, else "hover".
onEdit?(text: string) => voidEdit in place on the user's own message: called with the new text.
editing?booleanControls whether the editor is open.
onEditingChange?(editing: boolean) => void
versionIndex?numberVersions of an edited message or a regenerated answer: "‹ 2/3 ›" (0-based index).
versionCount?number
onVersionChange?(index: number) => void
versionBusy?booleanWhile a version is being made.
before?ReactNodeContent above the bubble: a tool call, the reasoning, an approval card.
after?ReactNodeContent below the bubble: an approval card, a form, a result.
children?ReactNode
feedback?"up" | "down" | null
linkAs?ElementTypeRouter link for relative links in the text.
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.