Skip to content
Thrum

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-scramble

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
childrenstringRequiredThe text. It is what assistive technology reads, at every moment. A new text scrambles into place.
durationnumberDefault 0.7Seconds from the first random frame to the final text.
charactersstringDefault "A…Z0…9#%&*+=?"The glyphs to draw from while the text is scrambled. Spaces in the text are never scrambled.
playOnMountbooleanDefault trueScramble when the component mounts.
playOnHoverbooleanDefault falseScramble each time the pointer enters the text, unless a scramble is running.
triggerstring | number–Scramble again each time this value changes: a counter, an id, a status.
seednumber–Fixes the random glyphs. By default they come from the text, so the same text always scrambles the same way.
pausedbooleanDefault falseFreeze a scramble where it is, and start no new one.
soundbooleanDefault truePlay a soft tick when a scramble settles, if the visitor has sound on.
classNamestring–Extra classes, merged last. A monospaced font keeps every frame the same width.
...propsOmit<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

SourcePro

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. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor