Skip to content
GitHub (opens in a new tab)

Chat

Assistant panel with a header, a thread and a composer.

stableOrganismcontracts/chat.json

Preview

Chat

Assistant panel with a header, a thread, and a composer. Answers can carry figures, a table, a chart, sources and follow-ups. Not Modal.

Master

Live panel. Pick a suggestion: the steps run, then the answer lands with figures, a table and a chart.

Assistant

Good morning, Ada

Ask about this dashboard. I answer from the data on screen.

Asking about Revenue overview · Last 3 monthsRevenue overview · Last 3 months
Yesterday
Nov 18

Usage

Use Chat for an inline assistant panel. With no messages, greeting, intro, suggestion rows and recents fill the panel. While it works, thinkingSteps shows the steps and onStop turns Send into Stop. Close clears the demo.

Do's

  • An inline assistant beside a workspace
  • An assistant that answers with figures, a small table or a chart from the data on screen
  • Showing the steps behind an answer while it works, with Stop
  • A guided empty state: greeting, page context, suggested questions and recents
  • A help thread with send and a thinking state
  • Suggested prompts above a composer
  • Asking about one part of a screen, like a chart card, with context naming it
  • A tab of a work panel or Drawer that already has its own title and edge — embedded
  • An assistant start page whose data is still loading — loading
  • An assistant start page with a few short prompts as buttons — suggestionLayout grid
  • A start page that shows the key figures the assistant reads, in one mono line under the intro — summary
  • A start page whose composer is the main action, with a visible label above the suggestions — composerLabel
  • An answer that proposes a plan to approve — a plan part (kit AgentPlan) in the message, with sendAppearance soft
  • A composer that takes files: paste, drop or pick, with chips, progress and Retry — attachments with onAttach
  • Asking, editing or planning from one composer — mode (ask, edit, plan)
  • Letting the person pick the model next to Send — models
  • Typing by voice where the browser can — dictation
  • Running a command or pointing at a file, person or tool as a token — commands and mentions

Don'ts

  • A blocking overlay — use Modal
  • A must-choose confirm — use AlertDialog
  • A short notice after an action — use Toast
<Chat
  title="Assistant"
  greeting="Good morning, Ada"
  intro="Ask about this dashboard. I answer from the data on screen."
  context={{ label: "Revenue overview · Last 3 months", onRemove: clearContext }}
  suggestions={[{ label: "What drove MRR this period?", hint: "Looks at MRR movements · 3 months", icon: "TrendingUp" }]}
  recent={recent}
  messages={messages}
  isThinking={busy}
  thinkingSteps={steps}
  onStop={stop}
  onSend={handleSend}
  onClose={close}
/>

Assistant panel with a header, a thread, and a composer. Answers can carry figures, a table, a chart, sources and follow-ups. One piece.

When to use

  • An inline assistant beside a workspace
  • An assistant that answers with figures, a small table or a chart from the data on screen
  • Showing the steps behind an answer while it works, with Stop
  • A guided empty state: greeting, page context, suggested questions and recents
  • A help thread with send and a thinking state
  • Suggested prompts above a composer
  • Asking about one part of a screen, like a chart card, with context naming it
  • A tab of a work panel or Drawer that already has its own title and edge — embedded
  • An assistant start page whose data is still loading — loading
  • An assistant start page with a few short prompts as buttons — suggestionLayout grid
  • A start page that shows the key figures the assistant reads, in one mono line under the intro — summary
  • A start page whose composer is the main action, with a visible label above the suggestions — composerLabel
  • An answer that proposes a plan to approve — a plan part (kit AgentPlan) in the message, with sendAppearance soft
  • A composer that takes files: paste, drop or pick, with chips, progress and Retry — attachments with onAttach
  • Asking, editing or planning from one composer — mode (ask, edit, plan)
  • Letting the person pick the model next to Send — models
  • Typing by voice where the browser can — dictation
  • Running a command or pointing at a file, person or tool as a token — commands and mentions

When not to use

  • A blocking overlay — use Modal
  • A must-choose confirm — use AlertDialog
  • A short notice after an action — use Toast

What an agent reads

import { Chat } from "agentic-ds-kit";
must
  • section named by title
  • thread is role=log with aria-live=polite
  • aria-busy while thinking
  • composer input has an accessible name
  • with context, the composer input is described by "Asking about <label>"; the Tag remove button is named Remove <label>
  • Send and Close are named icon-only kit Buttons
  • step lists are ordered lists; the active step has aria-current=step and each step's status is also in words
  • an error part is role=alert and names the problem with an icon and a title, not colour alone
  • the collapsed step row is a Button with aria-expanded that controls the step list
  • built-in labels (conversation, suggestedPrompts, send, chatContext, chatSuggested, chatRecent, chatStop, chatWorking, chatSteps, chatCopyDetails, retry) come from KitLabelsProvider; English by default
  • embedded keeps the section named by title (aria-label) though the header is hidden
  • loading sets aria-busy="true" on the section and disables the composer
  • with composerLabel, the composer input is named by its visible label
  • the plan-waiting chip is a named Button outside the log; it scrolls only the thread and moves focus to the plan's primary
  • Streaming follows the real stream: words that arrive fade in out of a light blur on the enter timing (40ms apart within one chunk, capped); text already shown stays plain, and the spans fold back into plain text when streaming ends. The caret breathes instead of blinking. The active thinking step label shimmers through kit ShimmerText. None of it moves under prefers-reduced-motion
  • the upgraded composer (any of attachments, onAttach, mode, defaultMode, modes, onModeChange, models, dictation, commands, mentions) uses a kit Textarea that starts at one line and grows to a max height; Enter sends, Shift+Enter adds a line. Without those props the composer is unchanged
  • with commands or mentions the field is a combobox (aria-autocomplete list) pointing at a listbox with aria-activedescendant; arrows move, Enter or Tab picks, Escape closes
  • tokens and attachment chips are kit Tags named by their text with a named remove button; Retry is named "Retry <file>"
  • attach, mic and Stop dictation are named IconButtons; the mode control is a radiogroup named Mode
  • a polite live region announces only an attachment that failed, recording started or stopped, and a mode change
  • built-in composer labels (composerAttach, composerDrop, composerAttachFailed, modeAsk, modePlan, composerMode, composerModeChanged, composerEditPlaceholder, composerPlanPlaceholder, sendEdit, sendPlan, dictate, dictationStop, dictationStarted, dictationStopped, composerCommands, composerMentions; reused: send, chatStop, retry, retryFile, edit, files) come from KitLabelsProvider
  • Composer motion is live only: a chip that arrives rises in, a removed chip exits, Send and Stop crossfade, the mic level moves only while recording. Nothing moves on first load or under prefers-reduced-motion
defaults
  • title Assistant
  • suggestionLayout list
  • placeholder How can we help you?
  • emptyState Start a conversation.
  • loading false
  • isThinking false
  • disabled false
  • sendAppearance solid
  • closeLabel Close
  • menuLabel More
  • radius lg
  • embedded false
  • dictation false
stops if
  • Do not put a context Tag outside Chat beside the composer — pass context
  • Do not invent ChatMessage, ChatInput, ChatHeader, ChatBubble, or ChatAvatar cousins
  • Do not use Modal for an inline assistant panel
  • Do not override Chat radius from the host — use radius none for a full-height workspace rail
  • Do not use raw hex
  • Do not use product-specific, billing-platform, or copilot wording in copy
  • Do not hide or restyle the Chat header from the host — use embedded
  • Do not use embedded for a standalone chat card; it has no title on screen
  • Do not use loading for a thinking answer — use isThinking; loading is for the data the assistant reads, before anything can be asked
  • Do not use suggestionLayout grid for long or many prompts, or when the hint matters — keep list (LinkList rows with hints)
  • Do not put status, sentences or a second intro in summary — it is one line of figures; status still needs words
  • Do not add a separate Field or label beside Chat for the composer — pass composerLabel
  • Do not put an AgentPlan beside or above Chat to stand for an answer's plan — pass a plan part
  • Do not build an attachment row, mode switch, model chip or mic beside Chat — pass attachments, mode, models or dictation
  • Do not put tokens inside the text with contenteditable — commands and mentions become Tag tokens at the start of the field
  • Do not upload inside Chat — onAttach hands files to the app, which passes attachments back

From contracts/chat.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
titlestringNoAssistant—
statusstringNo——
messagesarrayNo—ChatMessage[] with role user | assistant, content, optional id and timestamp. Type only — not a ChatMessage component. Assistant messages may add parts (ChatPart[], drawn in order under the text: metrics → kit Scorecard sm, table → kit Table sm with footer, chart → kit LineChart area as a sparkline (no Table toggle), sources → footer line, followups → kit Button sm outline pill that sends its text, plan → kit AgentPlan at the message's full width with maxVisibleSteps 3, stickyFooter and approvalLinks unless the plan says otherwise), steps (ChatStep[], collapsed into one "3 steps · 2.4s" row that opens the list), status (streaming | error) and error ({ title, description?, onRetry?, onCopyDetails? }). streaming shows a caret and a Skeleton for parts still coming; error shows a card with a warning icon, a soft primary Retry and an outline Copy details. While the newest draft plan with onAccept has its footer out of the thread's view, a kit Button sm soft primary pill above the composer (KitLabels chatPlanWaiting, "Plan waiting for approval", with an arrow toward the plan) scrolls the thread to the footer and focuses Accept.
suggestionsarrayNo—Prompts that send their text. Plain strings are kit Buttons sm above the composer. Objects { label, hint?, icon? } are rows (kit LinkList) in the empty state.
suggestionLayoutlist | gridNolistHow object suggestions show in the guided empty state. list: kit LinkList rows with the hint. grid: kit Button sm outline neutral with the suggestion icon, block width, two columns when each gets at least space-16 * 4 and stacked below that; labels wrap to a second line, the hint is not shown, and the Suggested label is a plain caption. Both send their label. While loading, grid shows four control-height Skeletons in the same grid.
contextobjectNo—What the next message is about, like the card and period a user asked from. A kit Tag sm above the composer; removable when onRemove is set. The composer input is described by it ("Asking about <label>").
placeholderstringNoHow can we help you?Default "How can we help you?", or "Available when your data loads" while loading.
emptyStatestringNoStart a conversation.—
greetingstringNo—Empty state heading, like "Good morning, Ada". Turns on the guided empty state.
introstringNo—Empty state line under the greeting: what the assistant can do here. With context, the context Tag moves under it.
summarystringNo—Empty state line under the intro in Geist Mono (caption, tabular figures): the key figures the assistant reads, like "October MRR $184,320 -3.1% vs September". Plain text.
composerLabelstringNo—Visible label above the composer input (kit Field label look); it names the input instead of the placeholder. In the guided empty state the labelled composer sits under the greeting block, above the suggestions (label, input and suggestions 8 and 16 apart, 32 under the greeting). Once the thread has messages the composer is at the foot.
recentarrayNo—Recent questions at the foot of the empty state. kit ListView sm. Picking a row runs onSelect, or sends its label through onSend when onSelect is unset, like a suggestion.
recentEmptyLabelstringNo—Shown under the Recent heading when recent is an empty array.
loadingbooleanNofalseData the assistant reads is still loading. The guided empty state keeps greeting and intro, shows kit Skeleton rows in place of the suggestions, and disables the composer (Send stays disabled). The section has aria-busy="true". With no placeholder set, the composer reads "Available when your data loads".
isThinkingbooleanNofalseShows kit ThinkingAnimation in the thread.
thinkingStepsarrayNo—While thinking: a live step list (done check, active Spinner, pending dashed circle, each with a status word for screen readers) in place of ThinkingAnimation.
onStopfunctionNo—While thinking: the composer reads "Working…" and Send becomes an outline Stop Button that calls this.
disabledbooleanNofalse—
valuestringNo——
defaultValuestringNo——
onValueChangefunctionNo——
onSendfunctionNo—(message: string, details: ChatSendDetails) => void. details holds the upgraded composer's done attachments, tokens, mode (when modes show) and model; callers that take only the text keep working.
sendAppearancesolid | softNosolidsoft when another solid primary shares the view (e.g. a waiting ApprovalCard).
onClosefunctionNo——
closeLabelstringNoClose—
menuItemsarrayNo—Optional overflow actions. kit DropdownMenu.
menuLabelstringNoMore—
radiuslg | noneNolglg is the standalone card. none squares the panel and drops the outer block/end borders so Chat can sit flush in a workspace rail.
embeddedbooleanNofalseInside a host that already has a title, an edge and padding (a work panel tab, a Drawer): no header band, no outer border, no inline insets of its own, and it fills the host height (min 20rem). Suggestions line up with the thread text. title still names the section; status, onClose and menuItems are not shown.
attachmentsarrayNo—Kit FileUpload items. Each is a kit Tag sm above the field: the name with its extension, "name · 40%" while uploading, a danger dot plus a ghost Retry IconButton ("Retry <name>") on error. Send stays disabled while any is uploading; done files go out in onSend details.
onAttachfunctionNo—(files: File[]) => void. Turns on the attach IconButton (picker), paste into the field and a quiet dashed drop zone over the composer. The app uploads and passes attachments back.
onAttachmentRemovefunctionNo—(id) => void. Makes chips removable; runs after the chip's exit.
onAttachmentRetryfunctionNo—(id) => void. The Retry beside an error chip.
acceptstringNo—Passed to the file picker.
modeask | edit | planNo—Controlled mode. mode, defaultMode, modes or onModeChange shows a kit SegmentedControl sm in the toolbar. The placeholder and Send's name follow it (Ask keeps placeholder and Send).
defaultModeask | edit | planNo——
onModeChangefunctionNo—(mode) => void
modesarrayNo—Which of ask, edit, plan to offer, in order. Default all three.
modelsarrayNo—kit ModelPicker models. Shows the picker sm, label hidden, in the toolbar: the current model name only.
modelstringNo——
onModelChangefunctionNo—(id) => void
dictationbooleanNofalseA mic IconButton that dictates into the field through the browser's own speech recognition. Hidden where the browser has none (and on the server). While recording: a kit Meter sm with the live level (not under reduced motion) and an outline Stop.
commandsarrayNo—"/" opens a listbox of these (label without the slash).
mentionsarrayNo—"@" opens a listbox of these. A pick from either list becomes a kit Tag token at the start of the field: removable, Backspace at the field's start removes the last one whole, sent in onSend details.
classNamestringNo——
  • Component
    →

    Modal

    Dismissible overlay for short tasks, forms, or extra detail.

  • Component
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.

  • Component
    →

    Toast

    A short note that floats in after an action, like Saved successfully, and goes away on its own after a few seconds, with an optional Undo.

  • Component
    →

    DropdownMenu

    Actions or value menu from a button, field, or nav trigger.