AI Streaming Text

Readable text block for partial assistant output with an optional live cursor while tokens stream in. Install AI Streaming Text from the VLLNT UI registry with the shadcn CLI.

Report a bug

When to use this in an AI app

Use AI Streaming Text for any partial assistant output that arrives token-by-token. The live cursor signals 'still generating' and keeps long responses readable as they stream in.

Browse all AI agent components

Readable text block for partial assistant output with an optional live cursor while tokens stream in. Part of the ai family in VLLNT UI, it ships as a machine-readable registry entry — copy the source directly into your app with the shadcn CLI and own it, no runtime dependency on a component library.

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Installation

Add AI Streaming Text to your project with the shadcn CLI. The source lands in your codebase, ready to adapt:

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/ai-streaming-text.json

Source

import { cn } from "../../lib/utils"; export type AIStreamingTextProps = React.ComponentPropsWithoutRef<"div"> & { /** Cursor glyph shown while streaming. */ cursor?: string; /** Whether new content is still arriving. */ isStreaming?: boolean; /** Whether to show the streaming cursor. */ showCursor?: boolean; /** Text content available from the stream. */ text: string; }; const AIStreamingText = ({ className, cursor = "▍", isStreaming = false, ref, showCursor = true, text, ...props }: AIStreamingTextProps & { ref?: React.Ref<HTMLDivElement> }) => { return ( <div aria-live={isStreaming ? "polite" : undefined} className={cn( "text-sm leading-6 text-foreground whitespace-pre-wrap", className, )} ref={ref} {...props} > {text} {isStreaming && showCursor ? ( <span aria-hidden="true" className="ml-0.5 inline-block animate-pulse text-muted-foreground" > {cursor} </span> ) : null} </div> ); }; AIStreamingText.displayName = "AIStreamingText"; export { AIStreamingText };

Stories

Explore every variant and state in the interactive Storybook:

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Dependencies

  • @vllnt/ui@^0.3.0