Text scramble
Text that resolves into place from random glyphs, for a headline that lands, a code that is revealed, a status that changes. Use it once on a screen, on a short line. For a label that says work is still going, use the text shimmer.
Install
npx shadcn@latest add @thrum-pro/text-scrambleThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | Required | The text. It is what assistive technology reads, at every moment. A new text scrambles into place. |
duration | number | Default 0.7 | Seconds from the first random frame to the final text. |
characters | string | Default "A…Z0…9#%&*+=?" | The glyphs to draw from while the text is scrambled. Spaces in the text are never scrambled. |
playOnMount | boolean | Default true | Scramble when the component mounts. |
playOnHover | boolean | Default false | Scramble each time the pointer enters the text, unless a scramble is running. |
trigger | string | number | – | Scramble again each time this value changes: a counter, an id, a status. |
seed | number | – | Fixes the random glyphs. By default they come from the text, so the same text always scrambles the same way. |
paused | boolean | Default false | Freeze a scramble where it is, and start no new one. |
sound | boolean | Default true | Play a soft tick when a scramble settles, if the visitor has sound on. |
className | string | – | Extra classes, merged last. A monospaced font keeps every frame the same width. |
...props | Omit<ComponentProps<"span">, "children"> | – | Every other span attribute and event handler is passed through. |
Motion and sound
Motion
- The text is replaced by random glyphs, which settle into the real characters from start to end, each at a slightly random moment, over 0.7 seconds by default. The glyphs change 30 times a second.
- The scramble is written into a copy laid over the real text, one frame at a time, without a React render. The real text keeps its place, so the box never changes size.
- The random glyphs come from a generator seeded by the text, so the server and the browser agree and no glyph is drawn until the scramble runs.
- paused freezes a running scramble; turning it off carries on from there.
- Reduced motion: no scramble. The text shows at once, and a running one ends.
Sound
- A soft tick when a scramble settles onto its final text.
Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works
Accessibility
- Screen readers read the real text, which stays in the page the whole time. The scrambled copy is aria-hidden; while it runs the real text is only made transparent.
- The scramble adds no role. A text that changes to report something belongs in a region with role="status".
- It flickers 30 times a second for under a second, in the text colour only, well under the limit for flashes. Keep it to short lines and run it once, not on a loop.
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/text-scramble.tsx- Packages
motion- Brings along
- Motion tokensSound engine
Changelog
- 1.0.0 · 2026-12-03First release.