skip to content
mpkcn

~/components/letter-reveal

Letter Reveal

Splits a heading into letters that spring up and flip into place one after another.

Hello, terminal.

hover the letters

Installation

terminal
npx mpkcn add letter-reveal
deps:framer-motion@13.4.4· tested with react@19.3.0

Usage

tsx
import { LetterReveal } from "@/components/mpkcn/letter-reveal";

export function Hero() {
  return <LetterReveal as="h1" text="Hello, terminal." className="text-5xl font-semibold" />;
}

Each letter starts 0.7em low, tilted back 80°, and springs into place (stiffness 260, damping 18), 35ms after the one before it. Words never break in the middle. Hovering a letter lifts it and turns it blue.

Examples

Slower stagger

one letter at a time

hover the letters

Replay on every scroll

trigger="view" plays the reveal each time the text comes back into view.

tsx
<LetterReveal as="h2" text="Selected work" trigger="view" />

Wait for an intro

play={false} keeps the letters hidden until you flip it, for example when a Boot Screen finishes:

tsx
"use client";

import { useState } from "react";
import { BootScreen } from "@/components/mpkcn/boot-screen";
import { LetterReveal } from "@/components/mpkcn/letter-reveal";

export function Hero() {
  const [booted, setBooted] = useState(false);
  return (
    <>
      <BootScreen onDone={() => setBooted(true)} />
      <LetterReveal as="h1" text="Hello, terminal." play={booted} delay={0.2} />
    </>
  );
}

Props

PropTypeDefaultDescription
textstring—The text to animate. Spaces are kept and words never break mid-word.
asReact.ElementType"span"Element to render, e.g. "h1" for a hero heading.
delaynumber0Seconds before the first letter starts.
staggernumber0.035Seconds between letters.
trigger"mount" | "view""mount""mount" plays once on load; "view" replays every time the text scrolls into view.
playbooleantrueHold the letters hidden until this turns true. Only used with trigger "mount".
hoverbooleantrueLetters hop up and turn blue on hover.
ignoreReducedMotionbooleanfalseAnimate even when the user prefers reduced motion. Only use it behind an explicit action, like a "play anyway" button.
classNamestring—Extra classes for the root element.

Accessibility

  • Screen readers read the text once, whole, from a visually hidden copy. The letter spans are aria-hidden, so the heading is never spelled out letter by letter.
  • Under prefers-reduced-motion: reduce nothing moves or flips: the letters only fade in, and the hover hop is reduced to the color change.
  • Server and client render the same markup, so there is no hydration mismatch.