Text Scramble
ProDecodes text from random glyphs on mount, hover or focus.
Installation
pnpm dlx shadcn@latest add @viewport/text-scramble
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| text* | string | — |
| characters | stringCharacters used while scrambling. | DEFAULT_CHARS |
| speed | numberMilliseconds between frames. | 28 |
| trigger | "mount" | "hover" | "both"When to play: on mount, on hover/focus, or both. | "both" |
| className | string | — |
Accessibility
- The real text is always available to screen readers.
- Replays on keyboard focus as well as hover.
- Shows the final text immediately under reduced motion.