This page as markdown: /streaming-text.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

StreamingText

Status: stable

Prose arriving from a live source, a token at a time. Each token resolves out of blur, the trailing edge stays soft while more is coming, and a steady caret marks the write head.

Keywords: streaming, stream, tokens, typewriter, generation, assistant, llm, caret, incremental

Usage

Use StreamingText for text whose final length is unknown while it renders — a model's answer, a live transcript, a log line being written. It is the counterpart to ThinkingOrb and Spinner: those cover the wait BEFORE the first token, this covers the arrival of the tokens themselves.

Best practices

Anatomy

Part Required Description
Container yes The paragraph (or as element). Carries aria-busy while output is incomplete.
Unit yes One word or character. Animates once on mount and never again; the newest one carries the softened tail while streaming.
Caret no The write head, shown while streaming. Steady rather than blinking — see motion-caret.

Props

Name Type Default Description
text string — The text received so far. Assumed append-only: the component keys units by index precisely so a grown string mounts only its new spans.
streaming boolean false Whether more is still coming. Drives the caret, the softened trailing edge, and aria-busy.
as ElementType "p" Render container element.
split "word" | "char" "word" Split granularity. char is one element per character — short strings only.
caret boolean true Show the caret while streaming. Turn it off when something adjacent already reports the wait.

Tokens used

foreground

Motion

Accessibility

Related

Examples

Streaming an answer

import { StreamingText } from "@sableui/react"

<StreamingText text={answer} streaming={pending} />

Inside a message, with the wait reported elsewhere

import { Message, StreamingText } from "@sableui/react"

<Message align="start"><StreamingText text={answer} streaming={pending} caret={false} /></Message>

A headline resolving character by character

import { StreamingText } from "@sableui/react"

<StreamingText as="h2" split="char" className="text-heading-2" text={headline} streaming={pending} />