184 Components

AI Streaming Text

Text

Character-by-character text renderer that simulates real-time AI token streaming, complete with a physics-spring blinking cursor that vanishes when generation completes.

Installation

Install directly into your project using the shadcn CLI or copy the source code manually.

Requires:framer-motionclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/ai-streaming-text.json"

Props

TypeScript props supported by <AIStreamingText />.

6 props
PropTypeDefaultDescription
textstring—The full text to stream.
speednumber28Milliseconds per character.
showCursorbooleantrueShow blinking cursor while streaming.
cursorCharstring"|"Character to use as cursor.
onComplete() => void—Called when streaming finishes.
autoRestartbooleantrueRestart animation when text prop changes.

Key Features

  • Configurable streaming speed per character in milliseconds.
  • Blinking pipe cursor with AnimatePresence fade-out on completion.
  • prefers-reduced-motion: instantly reveals full text.
  • onComplete callback for chaining responses or UI transitions.
  • Auto-restarts animation when text prop changes.

Keyboard & Accessibility

  • Uses inline span — preserves semantics for screen readers.
  • Full text visible immediately for reduced-motion users.