Typewriter
Types out text character-by-character with optional phrase cycling and pulsing cursor. Full copy stays in the DOM for SEO.
Design for clean, precise details. accessible keyboard navigation. delightful micro-interactions. subtle physics-based springs.
import { Typewriter } from "@/components/ui/typewriter";export function Headline() { return ( <h2> Built for{" "} <Typewriter text={[ "clean details.", "accessible navigation.", "delightful springs.", ]} speed={40} /> </h2> );}<Typewriter>
Typewriter effect for headers, quotes, and hero text. Full text stays in the DOM for SEO.
text*string | readonly string[]Text to type, or an array of phrases to cycle through.
cursordefaulttruebooleanWhether to show a blinking cursor (default: true).
cursorChardefault"|"stringCustom character for the cursor (default: "|").
cursorClassNamestringClasses for the blinking cursor.
delaydefault0numberMilliseconds to wait before starting typing (default: 0).
deleteSpeeddefault24numberMilliseconds per character while deleting (default: 24).
loopdefaulttruebooleanWhether to loop through phrases when text is an array (default: true).
onComplete() => voidCalled when the text is fully typed.
pauseDurationdefault2000numberMilliseconds to pause once a phrase is fully typed (default: 2000).
speeddefault40numberMilliseconds per character while typing (default: 40).
| Prop | Type | Default |
|---|---|---|
text*Text to type, or an array of phrases to cycle through. | string | readonly string[] | — |
cursorWhether to show a blinking cursor (default: true). | boolean | true |
cursorCharCustom character for the cursor (default: "|"). | string | "|" |
cursorClassNameClasses for the blinking cursor. | string | — |
delayMilliseconds to wait before starting typing (default: 0). | number | 0 |
deleteSpeedMilliseconds per character while deleting (default: 24). | number | 24 |
loopWhether to loop through phrases when text is an array (default: true). | boolean | true |
onCompleteCalled when the text is fully typed. | () => void | — |
pauseDurationMilliseconds to pause once a phrase is fully typed (default: 2000). | number | 2000 |
speedMilliseconds per character while typing (default: 40). | number | 40 |
* required. Every component also takes className.