Text Animations

Teletype

A line of type arriving one character at a time, at a rate that varies and with a beat at every mark.

Install

bun add motion clsx tailwind-merge

Then copy 3 files into your project:

  • components/registry/teletype/teletype.tsx
  • hooks/use-animation-loop.ts
  • lib/utils.ts

Props

PropTypeDefaultDescription
charsPerSecondnumber22Typing rate before jitter. Above roughly 40 the reader stops perceiving individual keystrokes and starts seeing a wipe.
deleteRatenumber2.4Erase rate as a multiple of the typing rate — deleting is never as deliberate as writing. At 0 the line is not erased at all: it is cut, and the next one starts clean.
holdnumber1500Dwell on a finished line before it is taken away. This is the only window the reader has to actually read it.
gapnumber420Empty beat between one line clearing and the next starting.
jitternumber0.45Spread on the per-line rate. At 0 the machine is a metronome, which reads as a progress bar rendered in letters rather than as typing.
punctuationPausenumber220Extra beat after a comma, period, dash or colon. The pause a reader hears at a mark is the silence that follows it, so it lands after the glyph, never before.
caret"block" | "bar" | "underscore" | "none""block"Shape of the cursor trailing the text.
caretBlinknumber1.05Seconds per blink cycle. The caret holds steady while characters are arriving and only blinks once the line is at rest — a terminal does the same, and the contrast is what makes the typing read as live.
loopbooleantrueWrap to the first line when the list runs out.
reserveSpacebooleantrueHold the box at the size of the longest line. Turn it off to watch everything below the type walk up and down the page — which is the reason it is on.
accentColorstring (hex)"#a855f7"The caret.

What It Demonstrates

Typewriter
Text appearing one character at a time, as if being typed.
Stepped animation
An animation that is divided into discrete steps, like a countdown timer.
Loop
An animation that repeats, a set number of times or infinitely.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.

Related Components

Appears In