Free · MIT licence · No dependencies

Text Scramble Free React component

A headline that decrypts itself: every letter flickers through random symbols before it locks into place. It plays when it scrolls into view, on hover or on a loop, and screen readers always get the real text.

  • React
  • CSS
  • Text
  • Reveal
  • Hero
Text Scramble

Get the code

Install in one linenpx shadcn@latest add https://alphenex.com/r/text-scramble.json

Works with any React project through the shadcn CLI. Prefer to paste it yourself? Copy the two files below into components/alphenex/. No Tailwind or animation library needed.

import TextScramble from '@/components/alphenex/text-scramble';

<TextScramble
  as="h1"
  text="Build something unforgettable"
  trigger="loop"
/>

How the text scramble works

Every character gets a start and an end time, spread from left to right with a little randomness so the reveal ripples instead of marching. Between the two times the character shows a random symbol that changes every few frames. After its end time it shows the real letter.

Drawing happens on animation frames by swapping the children of one span, not through React state, so a long headline costs a single DOM update per frame and React re-renders nothing.

The real text sits in aria-label and in the server-rendered HTML, so search engines and screen readers read the final words, not the symbols. With reduced motion turned on, the text simply appears.

Frequently asked questions

No. The page loads with the real text in the HTML and the effect only runs in the browser afterwards. The real text also stays in aria-label for screen readers.

Want motion like this on your website?

We design and build custom websites with motion, 3D and SEO built in. Websites from $500.

More free components

Explore our work