Streaming Text

Streaming Text

An AI-response text renderer — tokens materialize out of a blur at stream pace, trailed by a blinking caret that vanishes on completion.

Installation

▸ Run the following command

npx shadcn@latest add https://www.mellowui.com/r/streaming-text.json

▸ Or install manually

  1. Install dependencies: pnpm add motion
  2. Copy the source from the Code tab above.
  3. Place it at components/mellow/streaming-text.tsx
  4. Import and use.

API Reference

PropTypeDefaultDescription
textstringThe full text to stream in. Changing it restarts the stream.
by"word" | "char""word"Reveal granularity.
speednumber14Tokens revealed per second.
startDelaynumber0Delay before streaming starts, in ms.
cursorbooleantrueShow the blinking caret while streaming.
onComplete() => voidCalled once when the last token has been revealed.
classNamestringAdditional CSS classes.