Streaming Text
NewAnswer text that types itself out with a caret and light Markdown, and follows a real stream smoothly as it grows.
Installation
$ pnpm dlx shadcn@latest add @synccn/streaming-textFirst time in this project? Connect synccn with one command.
Usage
import { StreamingText, MarkdownLite } from "@/components/ui/streaming-text";<StreamingText text={partial} caret={!done} />API reference
Generated from the component's TypeScript types, so it always matches the code.
StreamingText
Text that types itself out like a model's answer, with a caret and light Markdown. Pass a growing `text` to follow a real stream; it catches up smoothly instead of jumping.
- textrequired
stringThe full text so far. It can keep growing while a response streams in.
- animate
booleanDefault
trueReveals the text gradually. Off shows it all at once (and so does reduced motion).
- speed
numberDefault
90Characters revealed per second.
- caret
booleanDefault
falseShows a blinking caret at the end, for example while the model is still writing.
- onDone
() => voidCalled once everything in `text` is visible.
- className
stringExtra classes for the root element.
MarkdownLite
The small slice of Markdown chat answers use: paragraphs, "- " and "1. " lists, **bold** and `code`.
- childrenrequired
stringText with paragraphs, "- " lists, **bold** and `code`.
- tail
React.ReactNodeRendered after the last line, such as a caret.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Accessibility
- aria-busy is set while text is still revealing. Reduced motion shows the full text at once.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-busy
- Respects the reduced motion setting