Scramble Text

Letters flicker through random characters, then settle left to right.

LOT 27 · HUILA · WASHED

Stone fruit and brown sugar.

Roasted on Monday, in your cup by Friday. Hover the lot line to play it again.

import { ScrambleText } from '@brand-studio/ui';

export default function ScrambleTextDemo() {
  return (
    <div style={{ width: '100%', maxWidth: 560 }}>
      <ScrambleText as="p" text="LOT 27 · HUILA · WASHED" className="demo-scramble" />
      <h3 style={{ margin: '12px 0 8px', fontSize: 'clamp(26px, 5vw, 40px)' }}>Stone fruit and brown sugar.</h3>
      <p style={{ margin: 0, color: 'var(--bs-muted)' }}>Roasted on Monday, in your cup by Friday. Hover the lot line to play it again.</p>
      <style>{'.demo-scramble { margin: 0; font: 600 13px/1.4 ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--bs-accent); }'}</style>
    </div>
  );
}

Installation

pnpm add @brand-studio/ui

Usage

import { ScrambleText } from '@brand-studio/ui';
<ScrambleText as="p" text="LOT 27 · HUILA · WASHED" />

It plays once when it scrolls into view, and again when a mouse moves over it. duration sets how long, in milliseconds, it takes to settle.

Accessibility

  • Screen readers hear the plain text once; the flickering copy is hidden from them.
  • The server renders the final text, and reduced motion keeps it still.
  • Keep it to short labels: a long line that flickers is hard to read.

API Reference

PropTypeDefault
textstring–
as?React.ElementType–
duration?number900
className?string''

Still, Deskhand and Hollis are fictional brands. The coffee photographs are original generated artwork. @brand-studio/ui is MIT licensed.