Skip to Content
zjkm-ui
Components

Scramble Text

Text that decodes from scrambled characters.

Access granted
Props
1.2s
<ScrambleText text="Access granted" />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/scramble-text.json
import { 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

PropTypeDefaultDescription
textstringThe text to decode to.
durationnumber1.2Seconds until the last character settles.
charactersstring"A–Z 0–9 #%&*+="The pool the scrambled characters come from.
classNamestringClasses for the outer <span>.

With reduced motion, the text shows as-is.

On this page