Search

Search the site

All components

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

1"use client";
2
3import { useState } from "react";
4import { StreamingText } from "@/registry/ui/streaming-text";
5import { Button } from "@/components/ui/button";
6
7const DEMO =
8 "Streaming text reveals word by word with an inline caret, useful for AI responses and onboarding copy.";
9
10export function StreamingTextDefaultExample() {
11 const [key, setKey] = useState(0);
12
13 return (
14 <div className="w-full max-w-xl space-y-4">
15 <Button variant="outline" onClick={() => setKey((k) => k + 1)}>
16 Restart
17 </Button>
18 <StreamingText
19 key={key}
20 content={DEMO}
21 isStreaming
22 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

NameTypeDefaultDescription
contentstringRequiredFull text to reveal
speednumber30Milliseconds between word chunks
isStreamingbooleanfalseWhen false, shows full content immediately
onComplete() => voidundefinedCalled when reveal finishes
classNamestring""Container classes