Black Friday is here 🔥 Get Wensity Pro for 20% less with

Text Scramble

A text scramble effect that decodes words from random characters on view or hover.

textscrambledecodehovertypographyanimation
Text Scramble component preview

Overview

Text Scramble is a React and Tailwind CSS text effect that decodes a headline out of random characters, in Next.js or any React app. It runs on load, in view, or on hover and keyboard focus, and inside a link it answers to the whole link. Use letters, numbers, binary, hex, symbols or your own string, locking in from the start, end, center or at random. Each letter holds its final glyph's width, so the line never shifts. Screen readers get one clean copy; reduced motion skips it. The visible letters are drawn in CSS, so they cannot be selected.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add text-scramble

Usage

Import TextScramble from @/components/wensity/text-scramble and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { TextScramble } from "@/components/wensity/text-scramble";
export default function Example() {
return (
<TextScramble
as="h1"
text="Signal from noise"
trigger={["view", "hover"]}
characters="alphanumeric"
className="text-7xl font-bold tracking-tight"
/>
);
}

Props

PropTypeDefaultDescription
textstring-The text to show. Changing it decodes into the new text.
askeyof React.JSX.IntrinsicElements"span"Tag rendered as the outer element.
trigger"mount" | "view" | "hover" | Array"view"Decode on load, when scrolled into view, or on hover and keyboard focus. Pass an array to combine.
characters"alphanumeric" | "letters" | "uppercase" | "lowercase" | "numbers" | "binary" | "hex" | "symbols" | string"alphanumeric"A preset, or any string of your own characters.
durationnumber0.9Seconds until the last character locks in.
speednumber50Milliseconds between random glyph swaps.
delaynumber0Seconds before the load or in-view run.
reveal"start" | "end" | "center" | "random""start"Which characters lock in first.
matchCasebooleantrueRandom letters follow the case of the letter they replace.
keepstringpunctuationCharacters that never scramble. Spaces never do.
oncebooleantrueWith the view trigger, decode only the first time.
scrambleColorstringtext colourColour of characters still scrambling.
scrambleOpacitynumber0.45Opacity of characters still scrambling.
controlRefReact.Ref<TextScrambleHandle>-Handle with play() for replays from your own controls.
onComplete() => void-Called each time a run finishes.
  • Text Shimmer component preview

    Text Shimmer

    A CSS shimmer sweep for headlines, one single element and entirely GPU-friendly.

  • Text Flip component preview

    Text Flip

    A 3D character flip on hover, staggered and springy across every single letter.

  • Text Morphing component preview

    Text Morphing

    Blur-morphing headlines that cycle phrases with a gooey, seamless crossfade.

  • Text Char Slide component preview

    Text Char Slide

    A per-character slide-left cascade with a cleanly staggered entrance timing.

Featured in React text animations.