Scramble Text
Text that decodes into place from random glyphs.
Uplink established
Relay 07, Kowloon uplink
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/scramble-text.jsonUsage
import { ScrambleText } from "@/components/ui/scramble-text"
<ScrambleText text="ACCESS GRANTED" charset="symbols" />Examples
On hover
Inside a link, hover and keyboard focus on the link both replay the decode.
Charsets
Four presets, or pass your own string of glyphs.
API reference
Also accepts native attributes for the element it renders.
| Prop | Type | Default |
|---|---|---|
text | stringThe text it decodes into. | None |
trigger | "mount"When the decode runs. hover replays it each time the pointer enters the text, or the link or button around it, and on keyboard focus. | "inView" |
duration | numberMilliseconds from the start to the last character locking in. | 900 |
charset | "upper"Glyphs it scrambles through. | "upper" |
as | "span"Element to render. | "span" |
color | NeonColorColor of the unresolved glyphs and the lock-in flash. | inherited |
Accessibility
- Screen readers get the real text once from a visually hidden copy; the scrambling cells are aria-hidden.
- Every character keeps the width of its final glyph while it scrambles, so nothing on the line shifts. Monospace faces decode most cleanly; in a proportional face a wide glyph can briefly overlap its neighbours.
- The decode runs on requestAnimationFrame and writes attributes directly, without React re-renders per frame.
- Under reduced motion the final text shows straight away.