Typewriter
Text typed out a key at a time with a caret. Give it a list and it types each line, erases it and moves to the next.
Typed out a key at a time, like someone is there.
Props
Caret
Speed (ms)55
Installation
pnpm dlx shadcn@latest add @breeze/typewriterUsage
import { Typewriter } from "@/components/breeze/typewriter"Give it one line to type it once:
<Typewriter text="Typed out a key at a time." className="text-3xl font-medium" />Or a list, and it types each one, holds it, erases it and moves on, round and round:
<Typewriter
as="h1"
text={["Build faster.", "Ship calmer.", "Sleep better."]}
className="text-5xl font-semibold"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | string[] | — | The text to type, or a list to type one after another |
as | "p" | "h1" | "h2" | "h3" | "h4" | "span" | "div" | "p" | The element to render |
speed | number | 55 | Milliseconds per character while typing |
eraseSpeed | number | 28 | Milliseconds per character while erasing |
pause | number | 1400 | Milliseconds to hold a finished line before erasing it |
delay | number | 0 | Milliseconds before typing starts |
loop | boolean | true | With a list, go back to the first and keep going |
humanize | boolean | true | Small random gaps between keys, so it feels typed by hand |
caret | "bar" | "block" | "underscore" | "none" | "bar" | The caret's shape, or none |
trigger | "view" | "mount" | "view" | Start when it scrolls into view, or as soon as it mounts |
It types with a little rhythm: small random gaps between keys and a short beat after punctuation. The caret stays solid while it types and blinks while it waits, like a real cursor. Space for the longest line is held from the start, so nothing around it jumps. Screen readers get the text at once, and with reduced motion it shows the first line with no typing.
Examples
Cycling a list
Build faster.. Ship calmer.. Sleep better.
<Typewriter
text={["Build faster.", "Ship calmer.", "Sleep better."]}
caret="block"
className="text-4xl font-semibold tracking-tight"
/>