Streaming
Text that streams from a model at a steady pace. Bursty chunks are smoothed out, with a fade on new words and a caret while it writes.
- Category
- AI
- Components used
- 2
- Files
- 4
- Usage examples
- 3
- Access
- HextaUI Pro (55 blocks)
- Source updated
- Counted in
- UI component usage study
Part of HextaUI Pro, all 55 blocks, $79 one-time, Compare plans
Models send text in bursts: a few words, a pause, then a whole sentence at once. Printing each chunk as it lands makes a reply stutter. Streaming keeps what you have received separate from what you show, and reveals it at a steady 90 characters a second.
When chunks pile up, the pace rises to close the gap in about 0.3 seconds, and once the stream ends the rest is flushed in about 0.12 seconds, so the text never trails far behind the model. Emoji and other multi-part characters are never split mid-reveal, and if the text is replaced rather than appended, as after a regenerate, the reveal restarts from what the two versions share.
Text that isn’t streaming renders in full on the first frame, so history and server renders never animate. StreamingText adds a soft fade on the newest words and a caret while it writes. useSmoothText gives you the pacing alone, to put in front of any renderer, including Markdown.
Get HextaUI Pro
One payment unlocks every block, including future ones. See pricing.
Add the Pro registry to components.json
components.json Add your token
Create a token on your account page and put it in
.env.localasHEXTAUI_PRO_TOKEN.Add the block
pnpm dlx shadcn@latest add @hextaui-pro/streaming
With the AI SDK
Render each text part of a useChat message. The part’s own state tells StreamingText when the model is still writing, so finished messages and history appear instantly.
With Markdown
Use the hook on its own to smooth the text before any renderer. Streamdown handles unfinished Markdown while it streams; react-markdown works the same way.
With any stream
Append each chunk to a string and pass it in. This works the same for fetch, OpenAI or Anthropic deltas, or server-sent events.
Anatomy
The parts you compose, from the outside in.
| Part | Description |
|---|---|
StreamingText | A drop-in text element that paces, fades and shows the caret. Use it for plain text replies. |
useSmoothText | The pacing on its own. Returns the text to show right now and whether it is still catching up. |
StreamingText
Also accepts every div prop except children.
| Prop | Type | Default |
|---|---|---|
textEverything received so far. Append to it as chunks arrive. | string | – |
streamingWhether more text is coming. Shows the caret and keeps the catch-up window open. | boolean | false |
smoothTurn pacing off to render text exactly as received. | boolean | true |
charsPerSecondBase reading pace before any catch-up. | number | 90 |
useSmoothText(text, options)
Returns { text, animating }. animating stays true until the shown text reaches the full text.
| Prop | Type | Default |
|---|---|---|
textThe full text received so far. | string | – |
options.streamingWhether the source is still sending. | boolean | false |
options.enabledWhen false, the hook returns the text unchanged. | boolean | true |
options.charsPerSecondBase reading pace. | number | 90 |
- The text container is a polite live region with aria-busy while it streams, so screen readers announce the reply once it settles instead of every character.
- The caret is decorative and hidden from assistive technology.
- With reduced motion, words appear without the fade and the caret stops pulsing. Pacing stays, because it is about reading speed, not motion.
Built with
The free HextaUI components Streaming is made from. Each one installs on its own.
Code
4 files, added to components/blocks/streaming.