23rd logo23rd

Typewriter

A playable SVG typewriter with moving keys, typebars, ribbon, and carriage.

Click it and type.

Preview

Installation

pnpm dlx shadcn@latest add @23rd/typewriter

Or from the public GitHub registry:

pnpm dlx shadcn@latest add radiumcoders/23rd.dev/typewriter

Usage

Give the parent a size; the machine scales to fit.

"use client"

import { Typewriter } from "@/components/ui/typewriter"

export function Letter() {
  return (
    <div className="h-96 w-full overflow-hidden rounded-xl border">
      <Typewriter text={"Dear reader,\nthe ribbon is fresh."} />
    </div>
  )
}

\n breaks a line; text wraps at columns characters.

<Typewriter loop={false} onDone={() => console.log("typed")} />
<Typewriter color="#D2463A" speed={8} columns={40} sound />

sound only plays after the visitor has clicked or pressed a key on the page.

Props

PropTypeDefault
colorstring"#8EC3B5", body enamel
textstringa short letter
speednumber12, characters per second
humanizebooleantrue, uneven rhythm
jitternumber0.3, 0–1
columnsnumber32, 16–60
loopbooleantrue
holdnumber2600, ms before looping
startDelaynumber600, ms
soundbooleanfalse
interactivebooleantrue
labelstringnone, nameplate text
onDone() => voidfires when the last character lands
classNamestringReact only
classstringSvelte only