Skip to content

Token Stream

Text arriving token by token with a caret, like a model's reply. Plays itself, or follows your real stream.

On this page

Examples

Model

Installation

npx knowns-ui@latest add token-stream
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

text
string
The reply. It splits into LLM-like tokens (words, long words in 3–4 letter pieces).
simulate
boolean
Defaulttrue
Play the text out by itself. false: you grow text as chunks arrive; new tokens fade in.
streaming
boolean
With simulate={false}: show the caret while the reply is still arriving.
speed
number
Default32
Tokens per second, with jitter and a beat after punctuation.
delay / loop
number (ms)
Default300 / -
Wait before starting; replay this long after the end.
caret
boolean
Defaulttrue
A thin caret while tokens arrive.
startComplete
boolean
Defaultfalse
Start with the whole text shown, then replay on loop. For posters and previews.
onDone
() => void
Called when the whole text is out.
Accessibility
-
Screen readers get the full text once; the animated layer is aria-hidden. prefers-reduced-motion shows the final text. Pauses offscreen, in hidden tabs and on paused.

When to use

When to use

  • Text that should arrive token by token with a caret, like a model's reply, or following a real stream.

When not to use

  • A full answer with sources and actions: use AI Answer.
  • Marketing copy that types and retypes phrases: use Typewriter.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Token Stream to my app and wire it to my own data.
  • I need text that should arrive token by token with a caret, like a model's reply, or following a real stream. Set that up with the Knowns UI Token Stream.
  • Which Token Stream props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "token-stream" }) and search_docs({ query: "token stream" }).

Need help?

Stuck on Token Stream, or found something off? We read every message.