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.

Conversation

A chat's thread: a new reply starts in view, then it follows, and a reply is announced once.

When to use it: For a chat with an AI agent, in an app, a side panel or a help sheet. Starter prompts until it starts.

Apps, websites and embeds

Example

You said

Can I move the due date on invoice INV-1042?

Acme Assistant (AI) said

Acme Assistant

Yes. Open the invoice, choose Edit and change Due date. Brightwater Coffee gets the new date with the next reminder.

You said

And can I add a late fee to it?

Acme Assistant (AI) said

Acme Assistant

Writing a reply

What can I help with?

Ask about your invoices, clients and payments. Acme Assistant can make mistakes, so check what matters.

Guidelines

  • Preserve access around motion: respect reduced-motion preferences, provide pause or stop controls where required, avoid harmful flashing and keep content and controls usable. motion.purpose
  • Design loading, empty, error and success states for every view, each saying what happened and what to do next. An error says what is wrong and what to do ("Enter a date after today"), never "Invalid" or "Error" alone. composition.states
  • Keep focus visible: the kit's ring, or a replacement at least as visible. Draw focus styles on :focus-visible, so a mouse click leaves no ring. A control that takes focus stops clear of every sticky bar, top and bottom, with its ring in view: give the controls a scroll margin of the bar's height plus room. a11y.focus-visible

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

The thread of a chat with an AI agent: its Messages, oldest first, in a named region that scrolls (it fills its parent's height, or height). On first paint it shows the latest turn. A new turn's start lands near the top of the view with a peek of the turn before, and a reply grows into the view without moving it; once the reply fills the view the thread follows its newest line. Any scroll of the reader's stops following at once, and "Jump to latest" takes them back (smooth, instant under reduced motion). Older turns added above keep the reader's place, and turns scrolled out of view above fade at the region's top edge. One status region says when a reply starts and, once, when it ends (its text, or the Message's announcement); never word by word, and never for turns loaded with the page. With no turns, the region opens at its top with a welcome: title, description and up to four starters (onStarter), gone once the first turn is there and back when the turns are cleared. headingLevel (default 2) sets the welcome's and each turn's heading level.

Styles: css/conversation.css.

How it’s built

The engineering patterns inside Conversation, each explained in Turtlekit Editorial.

Headless components and providers

Messages inside read the thread's context to report a new turn and its start and end, and take its heading level.

Deriving state

The welcome shows exactly while there are no children turns; nothing is stored, so clearing the turns brings it back.

Empty state

The empty thread is a designed welcome: what it can do in one line and the starter prompts as buttons.

Effect separation

Following lives in a plain DOM engine bound once in a layout effect (scroll, wheel, touch, keys and a resize observer), apart from rendering.

Latest ref

The announcement words sit in a ref, so the stable context callbacks read the current labels.