Skip to content
Pixelbits
Docs / Text scramble
Signature

Text scramble

Text that decrypts from random glyphs, left to right, into the real words. The final text is laid out invisibly underneath, so the width never jumps; screen readers get the final text only. Frames update the DOM directly (no React render per frame). Reduced motion shows the text at once.

Crafted with care

Installation

npm: import
import { TextScramble } from "pixelbits/text-scramble";
shadcn: copy the source
npx shadcn add https://pixelbits.ali-moradi-develop.com/r/text-scramble.json

API

<TextScramble>

Text that decrypts from random glyphs, left to right, into the real words. The final text is laid out invisibly underneath, so the width never jumps; screen readers get the final text only. Frames update the DOM directly (no React render per frame). Reduced motion shows the text at once.

Example
<h1><TextScramble text="Crafted with care" /></h1>
PropTypeDefaultDescription
text*string—

The final text. Changing it scrambles over to the new text.

trigger"view" | "hover" | "change""view"

When it runs: once in view, on hover and focus, or only when text changes.

durationnumber720

Total duration in ms.

glyphsstring"#%&*+=/<>[]{}01"

Characters used while scrambling.

Also accepts every prop of Omit<HTMLAttributes<HTMLSpanElement>, "children">.