Ballmac UI home

Scramble Text

Decodes text in place: each character cycles through random glyphs before settling, left to right. Plays on mount, in view or on hover, keeps its final width, and exposes the final text to screen readers.

acme deploy --prod

PRODUCTION IS LIVE

  • Resolved 214 packages1.2s
  • Built 38 routes8.4s
  • Uploaded to 35 regions3.1s
  • Health checks passed0.9s
https://acme.com200 OK

Installation

$ pnpm dlx shadcn@latest add @ballmac/scramble-text

Usage

import { ScrambleText } from "@/components/ballmac/scramble-text"

The full example is in the Code tab above.

Examples

On hover

API reference

PropTypeDefault
children*

The final text.

string—
as

The element to render.

ScrambleTextElement"span"
trigger

When to play: on mount, when scrolled into view (once), or on every hover and keyboard focus.

"mount" | "inView" | "hover""mount"
duration

Milliseconds from the first scrambled frame until the last character settles.

number900
delay

Milliseconds to wait before starting.

number0
speed

Milliseconds between frames; lower values cycle glyphs faster.

number40
characters

Glyphs to cycle through before each character resolves.

stringGLYPHS
mono

Use a monospace font so the width never changes while scrambling.

booleanfalse
onComplete

Called after the text has fully resolved.

() => void—

Also accepts the standard attributes of its root element.

Use with AI

<ScrambleText trigger="mount" | "inView" | "hover">Final text</ScrambleText>. Children must be a string. Frames are written straight to the DOM (no re-renders); an invisible copy of the final text reserves the layout and an sr-only copy is what assistive tech reads. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Scramble Text (@ballmac/scramble-text) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Terminal, security or developer-tool moments (status lines, keys, hashes)
  • Short headings that reveal on scroll
  • Nav links or buttons with a hover flourish (trigger="hover")

Not for

  • Paragraphs or anything longer than a line
  • Text that updates often (the scramble restarts each time)

Registry JSON: https://ui.ballmac.com/r/scramble-text.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils