Skip to content
Design System
GitHub

One turn of a conversation with a model or agent: a role word, name and time (never a bubble colour), any body, then its actions and a quiet line of facts; streaming is aria-busy.

YouKai Chen

Which robots can cover the loading bay tonight?

AssistantFleet assistant
Done in 2.4 s · first token 0.3 s

Two can. Patrol dog 1715 is free after its car park round at 23:40 and ends the night at 31 % battery.

Patrol dog 9E37 is free too, but it is still waiting at door C3, so it would start late.

Large 2.4 s 1,204 tokens

Turns

Install
npx shadcn add @syncrobotic/message

Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/button, @syncrobotic/format-number, @syncrobotic/streaming-text

Overview

When to use

  • An operator's assistant: the person's question and the assistant's streamed answer.
  • An agent's tool calls shown in the conversation, each a Tool turn with a Trace inside.
  • A system note at the start of a conversation: what the assistant may and may not do.

Use something else

  • One answer on its own, with no conversation around it: Streaming text.
  • An agent run read step by step: Trace, or the agent-trace block.
  • Comments people leave on a record: Timeline.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

Streaming

Tool

Error

Stopped

Align end

System

Traditional Chinese (zh-TW)

Usage rules

  • Map your API's role straight to role: user, assistant, tool or system.
  • Who spoke is the role word in the header (You, Assistant, Tool, System), with name after it (the person, the assistant, the tool called). Never tell roles apart by a bubble colour or by alignment alone: align="end" may move a person's turns to the end of a wide container, and they keep the word.
  • Every turn is on neutral ground. A person's turn has a quiet surface (muted) by default; nothing takes a colour for its role.
  • Pass time already formatted ("14:02") and dateTime for machines. Format it once in the browser, or with a time zone, so the server and the page agree.
  • The body is children: StreamingText for a streamed answer, Trace for tool calls, Attachment for files, your markdown renderer. Message parses nothing.
  • While the answer arrives set status="streaming" (aria-busy). When the body is StreamingText, leave the final state to it (its status row says Done, Stopped or Failed) and clear status; use Message's error and stopped for a turn whose body cannot say it, such as a person's turn that was not sent.
  • Facts about the answer go in footer with MessageMeta (model, duration, tokens, numbers through format-number); its actions go in actions (message-actions).
  • The same speaker's next turn takes continued: the header stays for screen readers only. Put the turns in a message-scroller.

Changelog

  • 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
  • 0.53.02026-11-27Read without stray punctuation: names come from the words shown, with real spaces between them. Its doc opens with its description.
  • 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.

How to upgrade