Skip to content
Get started

Search the docs

Quick start
Installation
Build your first page
What is public
Thinking in Turtlekit
Apps, websites and embeds
Components or native elements
Colour
Typography
Layout
Spacing, icons and shape
Components
Root
Layout
Typography
Code block
Button
Icon button
Button group
Call to action
Toolbar
Field
Text field
Text area
Select
Combobox
Date input
Save bar
Newsletter signup
Prompt box
File upload
Calendar
One-time code
Checkbox
Radio group
Switch
Segmented control
Toggle
Slider
Attachment
Response
Badge
Card
Data list
Item
Icon tile
Num
Time
Metric
Accordion
FAQ
Avatar
Media
Scroll area
Resizable
Carousel
Image slider
Logo cloud
Testimonials
Steps
Conversation
Message
Table
Data table
Chart
Site header
Site footer
Tabs
Page header
Breadcrumb
Pagination
Sidebar
Navigation menu
Callout
Error summary
Toast
Empty state
Skeleton
Progress
Spinner
Tooltip
Dialog
Popover
Hover card
Dropdown menu
Context menu
Menubar
Command
Elements area
Visually hidden
Error boundary
Design rules
Staying within the kit
Layout
Icons
Images and media
Typography
Readability
Colour
Composition
Accessibility
Elements
Motion
Interaction
AI pitfalls
Pricing
React design patterns
Single responsibility in React components
Presentational and container components in React
Children, function children and render props in React
The variant pattern in React
Compound components in React
Higher-order components in React
State colocation in React
Lifting state up in React
Deriving state during render
One status instead of many booleans
Adjusting state when a prop changes
Reading context with use() in React 19
Context selectors in React
Custom hooks and hook composition in React
One effect per concern in React
The latest ref pattern in React
Effect Events with useEffectEvent in React
Detecting the first render in React
Exposing methods with useImperativeHandle in React
Debouncing input in React
useDeferredValue in React
Loading components on demand in React
Virtualising long lists in React
Guard clauses and early returns in React
Skeleton placeholders in React
Rendering partial data in React
Empty states in React
Error boundaries in React
Reading async data with use() and Suspense in React
useTransition and Actions in React
Optimistic UI updates with useOptimistic
useActionState and form Actions in React
useSyncExternalStore in React
Ref as a prop and ref cleanup in React 19
Accessible ids with useId in React
Portals in React
Roving focus and keyboard navigation in React
Controlled and uncontrolled components in React
The state reducer and prop getters in React
Headless components and the provider pattern in React
The polymorphic as prop in React

Appearance

These change every page and preview on this site.

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.

Apps, websites and embeds

Example

You said

I was charged twice for November.

Acme Assistant (AI) said

Acme Assistant

I can see two payments on 1 November, the second a minute after the first. A refund needs someone from billing: I have passed them your account and both payments.

Maya Chen said

Maya Chen

Hi, Maya from billing here. I have refunded the second payment; it reaches your card in three to five days.

You said

How much is still unpaid from October?

Acme Assistant (AI) said

Acme Assistant
The connection dropped before the reply finished. Your question is kept.

Acme Assistant (AI) said

Acme Assistant

The website redesign. It is due in 4 days and 24 of its 61 tasks are still open, while the plan puts the last two weeks on testing alone. Ask whether the launch can move, or which pages can wait.

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.