Skip to content
Calm motion: animations on this site only fade, with no movement

Streaming text ​

Text that comes in part by part, with a caret

Shows the reply of an assistant while it comes in, for example from a model that sends a few words at a time. Put it in a bubble, under a prompt input.

Basic
  • text is all the text that came in so far. Add each new part to it. done tells the component that the last part came in.
  • A caret shows at the end of the text until done. It stops blinking when the system asks for reduced motion.
  • Parts often come in at an uneven rate. pace shows the text at an even rate (letters a second) between parts, and it moves faster when it is far behind. done shows the rest at once. With reduced motion, each part shows at once.
  • If text does not continue the old text, for example for a new reply, the text starts over.
  • The text keeps its line breaks. For Markdown, use the default slot, which gets the shown text: <template #default="{ text }"><BlessMarkdown :source="text" :lexer /></template>.
  • The text is a polite live region with aria-busy while text comes in, so screen readers wait and read the full reply, not each part.

Usage ​

ts
import { BlessStreamingText } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
text*string—all the text that has come in so far; it grows as parts arrive
doneboolean—the last part came in: the caret goes away and screen readers read the text
pacenumber0letters a second, to show the text at an even pace between parts; 0 shows each part at once

Slots

NameScopeDescription
default{ text: string; }

Released under the MIT License. Character names and artwork belong to their owners.