Components
Scramble Text
Text that decodes from scrambled characters.
<ScrambleText text="Access granted" />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/scramble-text.jsonimport { ScrambleText } from "@/components/scramble-text"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
The text decodes from random characters, left to right, once it scrolls into view. Spaces stay put, so words keep their shape. Screen readers only ever get the real text. Changing text plays it again.
import { ScrambleText } from "@/components/scramble-text";
export function Status() {
return <ScrambleText text="Access granted" className="font-mono" />;
}A monospace font keeps the width steady while the characters change.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | The text to decode to. | |
duration | number | 1.2 | Seconds until the last character settles. |
characters | string | "A–Z 0–9 #%&*+=" | The pool the scrambled characters come from. |
className | string | Classes for the outer <span>. |
With reduced motion, the text shows as-is.