Skip to main content

Typewriter

Animated text typing effect that cycles through a list of words. Characters are typed one at a time, paused, then deleted before the next word begins.

Supports a static prefix and configurable speed.

Summary

The Typewriter component is a compound component with three parts: the main Typewriter wrapper, a Typewriter.Prefix for static text, and Typewriter.Word for each animated word. The animation cycles through typing, pausing, deleting, and advancing to the next word.

Why Use This Component?

  • Engaging hero text — add dynamic text cycling to landing page headings.
  • Configurable timing — control type speed, delete speed, pause duration, and loop behavior.
  • Compound API — static prefix and animated words are declared as JSX children for clean composition.

Usage

Options

Typewriter (main)

PropTypeDefaultDescription
childrenReactNodePrefix and Word sub-components. Required.
typeSpeednumber | undefined80Milliseconds between each typed character.
deleteSpeednumber | undefined50Milliseconds between each deleted character.
pauseDurationnumber | undefined3000Milliseconds to pause after typing a word.
loopboolean | undefinedtrueWhether to loop back to the first word after the last.

Typewriter.Prefix

PropTypeDefaultDescription
childrenReactNodeStatic text before the cursor.

Typewriter.Word

PropTypeDefaultDescription
childrenstringWord to animate.

Troubleshooting

  • Animation not visible — Ensure at least one Typewriter.Word is passed as a child. Without words, nothing animates.
  • Loop stops — Set loop={false} to stop on the last word. The final word stays visible after typing completes.
  • Width jumps — The component measures each word to set a stable width. If words are very different lengths, you may see the container resize between words.