Message
One turn of a chat, the reader's or an AI agent's, with its status in words and actions in reach.
When to use it: Inside a Conversation, one per turn. An agent's turn always carries its mark and name.
Example
Guidelines
- Give every status and meaning a word, an icon or a pattern as well as colour.
colour.not-alone - Give every button, link and icon button a name, every image alt text (alt="" for decoration), and every SVG aria-hidden or role="img" with a name.
a11y.accessible-name - Put feedback next to its cause: a field error under its field, a result beside its action.
composition.feedback-near-cause
Add it to your project
It’s included in turtlekit.css and the turtlekit package: install it.
Your AI will also copy only this component, and what it needs, into your project. That comes with Turtlekit Pro, opening soon. Hear when it opens.
In detail
One turn of a conversation, an article with a hidden heading naming the speaker. from: "you" (the reader's words in a quiet bubble on the end side, line breaks kept), "agent" (an AI: Avatar's agent mark and its required name, which tell people it is an AI; its heading says "(AI)") or "person" (another person, a hand-over: avatar, name). children is the content (Response for an agent's answer), with time and attachments (chips). status: sending (in the time's place, so the turn keeps its height), streaming (aria-busy, a working line in words), done, stopped (what arrived kept) or failed (error in words, Retry). Actions on a Toolbar under it, always shown and reachable by keyboard and touch, never on hover alone: Copy (copyText, "Copied" announced), Helpful and Not helpful (feedback, defaultFeedback, onFeedbackChange; pressed again clears), Retry (onRetry), Edit (onEdit, the reader's turn) and the app's own (actions); none while a reply streams. Inside a Conversation it reports its start and end for the thread's one announcement (announcement gives a summary). Every string is a prop.
Styles: css/conversation.css.
How it’s built
The engineering patterns inside Message, each explained in Turtlekit Editorial.
Controlled and uncontrolled components
feedback with onFeedbackChange, or defaultFeedback, through useControllableState.
Variant pattern
from and status are closed sets; from sets the side, the avatar and the hidden heading.
Single status
One status (sending, streaming, done, stopped, failed) decides the working line, the failure and whether the actions show.
Partial rendering
The time, attachments, status line and each action render only when given; a turn with no handlers has no toolbar.
useId
The hidden heading's id from useId names the article.
