StreamingText
Typewriter animation component for AI streaming responses. Handles cursor, timing, and can be paused/resumed.
Preview
Props
| Prop | Type | Default | Description |
|---|---|---|---|
content | string | — | Full text to stream character by character. |
speed | number | 30 | Delay in ms between characters. |
showCursor | boolean | true | Show blinking cursor at the end. |
cursorChar | string | "|" | Character used for cursor. |
onComplete | () => void | — | Callback when streaming finishes. |
autoStart | boolean | true | Start immediately on mount. |
wordPause | number | 0 | Extra pause in ms between words. |
streaming | boolean | true | Pause/resume control. |
onCharacter | (index: number) => void | — | Fires after each character rendered. |
Performance
StreamingText uses a single state index and timeouts to avoid unnecessary re-renders.