Components

Hyper Text

A text scramble effect for React and Tailwind CSS: every letter cycles through random characters and the text decodes left to right on hover, when it scrolls into view or on mount. Each letter's width is reserved by the real glyph so nothing shifts, the server renders the plain text, and screen readers always get the real words.

  • Scramble / decode
  • No layout shift
  • Seeded, no hydration mismatch
  • No re-renders
  • prefers-reduced-motion

Deploy complete

Hover the headline to run it again.

Installation

$ npx shadcn@latest add https://duskui.com/r/hyper-text.json

Usage

hero-title.tsx
import { HyperText } from "@/components/dusk/hyper-text/hyper-text"

export function HeroTitle() {
  return (
    <HyperText as="h1" className="font-mono text-6xl font-bold">
      ACCESS GRANTED
    </HyperText>
  )
}

Examples

On hover

trigger="hover" decodes on pointer enter or keyboard focus. Inside a link or button the whole control triggers it, including its padding and its focus ring.

On mount, staggered

trigger="mount" starts before the first client paint. Offset lines with delay, and swap the noise with characters.

uplink
ESTABLISHED
cipher
AES-256-GCM
latency
12ms
status
ALL SYSTEMS NOMINAL

API Reference

Also accepts any HTML attribute for the rendered element.

PropTypeDefaultDescription
childrenstring—The text to decode. Plain text only.
as"span" | "p" | "div" | "strong" | "code" | "h1" … "h6""span"Element to render. Use a heading level for titles.
trigger"hover" | "inView" | "mount""inView"What starts the scramble.
replayOnHoverbooleantrueAlso replay on hover / focus when trigger is "inView" or "mount".
durationnumber800Milliseconds from the first letter scrambling to the last one resolving.
delaynumber0Milliseconds of pure noise before letters start to resolve.
charactersstring"A–Z0–9"Characters the letters cycle through. Lowercase letters get lowercase noise.
oncebooleantrueIn "inView" mode, play only the first time. When false it replays on every entry.
seednumber1Change it for a different, repeatable noise sequence.

Accessibility

  • The server renders the real text, and no random values are used during render, so there is never a hydration mismatch. Noise comes from a seeded generator inside effects.
  • Screen readers get the whole string from a visually hidden copy; the scrambling letters are aria-hidden so they're never announced.
  • Each letter cell is sized by its real glyph and the noise is drawn on top, so the line never changes width or rewraps. A monospace font gives the cleanest look.
  • Noise repaints about 20 times a second, written straight to the DOM with no React re-renders, and is never fast enough to strobe.
  • With prefers-reduced-motion the text simply stays put.