TextScramble

Text that animates in by rapidly cycling through random-looking characters before resolving, left-to-right, into the real final text — a "decrypt" reveal effect.

Installation

npx dafink-ui add text-scramble

Demo

Props

NameTypeDefaultDescription
textstring-Required. The final text to resolve to.
durationnumber800Total milliseconds for the scramble-to-resolve animation.
charactersstring'!<>-_\\/[]{}—=+*^?#'Charset used for scrambling filler characters.
classNamestring''Additional CSS classes.

Accessibility

TextScramble checks prefers-reduced-motion on mount inside a useEffect; when it matches, the requestAnimationFrame scramble loop never starts and the final text renders immediately and statically. The outer span's aria-label is always the correct final text from the first render onward, while the inner span holding the animated scrambling glyphs is aria-hidden, so screen readers never hear scramble noise regardless of animation state. It renders plain text with no interactive children, so there's no keyboard behavior to preserve or alter.