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/typewriter

Usage

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

PropTypeDefaultDescription
textstring | 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
speednumber55Milliseconds per character while typing
eraseSpeednumber28Milliseconds per character while erasing
pausenumber1400Milliseconds to hold a finished line before erasing it
delaynumber0Milliseconds before typing starts
loopbooleantrueWith a list, go back to the first and keep going
humanizebooleantrueSmall 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.