uimaxxer

Streaming text

A visible backlog. Words that arrive faster than reading pace wait as a faint run of dots after the caret, one per word, and each dot turns into its word as it lands, so you can see the model running ahead of the page.

npx shadcn@latest add @uimaxxer/streaming-text
Pro
PasskeysFix the duplicate Stripe charge

The checkout test keeps failing on CI but passes locally. Can you find out why?

Usage

import { StreamingText } from "@/components/ui/streaming-text"

const { messages, status } = useChat()
const last = messages.at(-1)

<StreamingText text={textOf(last)} done={status === "ready"} />

Props

PropTypeDefaultWhat it does
textstringEverything received so far. Append as tokens arrive, for example the text of the last message from useChat.
donebooleanfalseSet when the stream ends. The reveal catches up, then the caret goes.
pacenumber60Characters per second when the buffer is nearly empty. A burst drains over about 1.6s.
backlognumber14Most dots shown after the caret, one per word waiting. 0 hides the backlog.
onRevealed() => voidCalled once the last word is on screen.

Accessibility

  • The reply is an aria-live region marked aria-busy while it streams, so screen readers read it once, whole, instead of word by word.
  • Reduced motion keeps the fade and drops the blur and the lift.
  • The caret and the backlog dots are decorative and hidden from assistive tech.