skip to content
mpkcn

~/components/eyebrow

Eyebrow

A small mono label for above a heading that types itself out, with a block cursor, as it scrolls into view.

// 02 — selected work

Things I built

The label types itself each time it scrolls into view.

Installation

terminal
npx mpkcn add eyebrow
deps:none beyond react· tested with react@19.3.0

Usage

Put it right above a section heading:

tsx
import { Eyebrow } from "@/components/mpkcn/eyebrow";

export function Work() {
  return (
    <section id="work">
      <Eyebrow text="// 02 — selected work" />
      <h2>Things I built</h2>
    </section>
  );
}

Each time the label scrolls into view (80% visible) it clears and types itself back in at 32ms per character, with a blinking block cursor. The server renders the full text, so it is there before JavaScript runs.

Examples

Custom text

~/projects $ ls -la

Things I built

The label types itself each time it scrolls into view.

Type once, slower

replay={false} types it only the first time; speed sets the milliseconds per character.

tsx
<Eyebrow text="// 01 — about" replay={false} speed={60} />

Static label

typing={false} keeps the style and drops the animation.

tsx
<Eyebrow text="// changelog" typing={false} />

As a heading

The default element is a p. Pass as when the label is part of your outline:

tsx
<Eyebrow as="h2" text="// 03 — stack" className="mb-4" />

Props

PropTypeDefaultDescription
textstring—The label, e.g. "// 02 — projects".
asReact.ElementType"p"Element to render. Use "h2" or similar when the label is part of your heading structure.
typingbooleantrueType the label in when it scrolls into view. false shows it as plain text.
speednumber32Milliseconds per typed character.
replaybooleantrueClear the label when it leaves the viewport, so it types again next time.
ignoreReducedMotionbooleanfalseType 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 get the full label once, from a visually hidden copy. The typed characters and the cursor are aria-hidden, so nothing is announced letter by letter.
  • The untyped part of the text is still laid out (invisible), so the line never changes width or wraps differently while typing.
  • Under prefers-reduced-motion: reduce the label is simply shown, with no typing and no cursor.
  • Server and client render the same full text, so there is no hydration mismatch.