Text Scramble

Text that decrypts character by character with a scramble effect. Trigger on scroll, hover, or mount.

Component

Installation

 

Usage

Import

Add the TextScramble import.

import { TextScramble } from "@/components/text-scramble";

Use

Use with text and trigger mode.

<TextScramble text="Your text" trigger="inView" />;

Guidelines

  • Use trigger='inView' for hero headings that animate when scrolled into view.
  • Use trigger='hover' for interactive reveals.
  • scrambleSpeed: delay in ms between characters (0 = fastest).
  • Customize chars for different scramble character sets (e.g. '01' for binary).

Props

All props are optional unless marked required. Use these to customize every aspect of the component.

PropTypeDefaultDescription
textstring-The text to scramble and reveal.
charsstring"!@#$%^&*()_+-=[]{}|;:,.<>?"Characters to cycle through during scramble.
trigger"inView" | "mount" | "hover""inView"When to trigger: "inView" (scroll), "mount", or "hover".
scrambleSpeednumber0Delay in ms between characters. 0 = fastest (requestAnimationFrame).
cursorClassNamestring-Classes for the blinking cursor during scramble.
inViewThresholdnumber0.3IntersectionObserver threshold (0–1) for inView trigger.
classNamestring-Additional CSS classes.
onComplete() => void-Callback when scramble completes.

Examples

On scroll (inView)

Scramble animates when the text enters the viewport.

import { TextScramble } from "@/components/text-scramble";

<TextScramble
  text="Build Something Beautiful"
  trigger="inView"
/>;

On mount

Scramble runs immediately on mount.

import { TextScramble } from "@/components/text-scramble";

<TextScramble text="Hello World" trigger="mount" />;

On hover

Scramble runs when the user hovers over the text.

import { TextScramble } from "@/components/text-scramble";

<span className="text-2xl">
  <TextScramble text="Hover to reveal" trigger="hover" />
</span>;

Speed & chars

50ms delay per character, binary chars, custom cursor color.

import { TextScramble } from "@/components/text-scramble";

<TextScramble
  text="Slower reveal"
  scrambleSpeed={50}
  chars="01"
  cursorClassName="text-amber-500"
/>;

Threshold & callback

Triggers when 50% visible; onComplete callback.

import { TextScramble } from "@/components/text-scramble";

<TextScramble
  text="Custom threshold"
  inViewThreshold={0.5}
  onComplete={() => console.log("Done!")}
/>;

Last updated on Mar 5

Made with ❤️ by Pulkit & Cursor :)

© 2026 Pulkit. All rights reserved

DMCA Verified

Last updated: