Streaming Text
Word-by-word text reveal with inline caret and auto-scroll for AI responses and onboarding copy.
Default
Word-by-word streaming with caret
default-example.tsx
1"use client";23import { useState } from "react";4import { StreamingText } from "@/registry/ui/streaming-text";5import { Button } from "@/components/ui/button";67const DEMO =8 "Streaming text reveals word by word with an inline caret, useful for AI responses and onboarding copy.";910export function StreamingTextDefaultExample() {11 const [key, setKey] = useState(0);1213 return (14 <div className="w-full max-w-xl space-y-4">15 <Button variant="outline" onClick={() => setKey((k) => k + 1)}>16 Restart17 </Button>18 <StreamingText19 key={key}20 content={DEMO}21 isStreaming22 speed={25}23 className="rounded-lg border bg-card p-4"24 />25 </div>26 );27}
Installation & source
Install via the shadcn CLI or copy the registry files manually.
bash
npx shadcn@latest add @tt-ui/streaming-text
Props
| Name | Type | Default | Description |
|---|---|---|---|
| content | string | Required | Full text to reveal |
| speed | number | 30 | Milliseconds between word chunks |
| isStreaming | boolean | false | When false, shows full content immediately |
| onComplete | () => void | undefined | Called when reveal finishes |
| className | string | "" | Container classes |