Conversation core
Streaming answer
Use when an answer takes a few seconds to arrive and users need to see progress, where it came from and what to ask next.
Streamed reply with inline sources and follow-ups.
Part of Conversation core. The first thing you build: a place to ask and a place to read the answer. Every AI product ships these surfaces, so users compare yours with the best they have used. The work here is in the details: what the composer does mid-answer, how a reply arrives, what you can do with it afterwards.
Do
- Say what the agent is doing while it thinks, such as "Checking the inbox", not a bare spinner.
- Place each source chip at the claim it supports, as the text reaches it.
- Hold the sources row and follow-ups back until the answer is complete.
Don't
- Don't stream faster than people can read, or so slowly they wait for the end anyway.
- Don't let the block change height as it fills. Reserve room for the answer.
- Don't offer more than two or three follow-ups. They are a next step, not a menu.
States
- Thinking: The agent glyph with animated dots and a label. The answer area is empty but keeps its height.
- Streaming: The label becomes "Answer", text appears a few characters at a time behind a blinking caret, and source chips pop in where the text reaches them.
- Complete: The caret goes. A divider, the sources row with a count, and the follow-up prompts slide in.
- Follow-up chosen: The answer resets to thinking and streams the new reply with its own follow-ups.
Usage
import { StreamingAnswerPattern } from "./halaska-kit";
<StreamingAnswerPattern
segments={[
{ t: "Lumen Labs has 3 open tickets, all about invoice exports." },
{ chip: "intercom.com" },
]}
sources={[{ name: "Intercom", domain: "intercom.com" }]}
followups={["Who owns the Lumen Labs account?"]}
onFollowup={ask}
/>
StreamingAnswerPattern props
segments({ t: string(default STREAM_ANSWERS.default.segments): | { chip: string })[]} The answer as text runs and inline source chips, in order; streaming restarts whenever it changes (default: the Acme ticket demo answer)sources{ name: string, domain: string }[](default STREAM_SOURCES): Sources row shown once streaming completes (default: STREAM_SOURCES)followupsstring[](default STREAM_ANSWERS.default.followups): Follow-up prompts listed under the answer (default: the demo follow-ups)thinkingLabelstring(default "Checking the inbox"): Label beside the dots while thinking (default: "Checking the inbox")answerLabelstring(default "Answer"): Caption that replaces the thinking indicator once streaming starts (default: "Answer")sourcesLabel(n: number) => string(default n => `${n} sources`): Caption above the sources row, given the source count (default: n => `${n} sources`)followupsLabelstring(default "Follow-ups"): Caption above the follow-up list (default: "Follow-ups")thinkMsnumber(default 700): Thinking duration before the first character appears (default: 700)charsPerTicknumber(default 2): Characters revealed per tick (default: 2)tickMsnumber(default 18): Milliseconds between ticks (default: 18)autoplayboolean(default true): Think → stream on mount; false renders the finished answer immediately with no timers (default: true)onFollowup(text: string) => void: Fires when a follow-up is clicked; the parent then swaps `segments`/`followups`. When omitted, the demo toggles to its built-in second answeronDone() => void: Fires when streaming completes (not fired when autoplay is false)
Built from
Agent Glyph, Label, Separator, Stack, Thinking Indicator, Typography
Related patterns
Halaska UI · Components · Patterns · Screens · Install