Docs
Scramble Text
Scramble Text

A dynamic text animation component that creates an engaging scramble effect with customizable speed, intersection observer support, and accessibility features.

Welcome to Delta Components

Overview

The Scramble Text component creates captivating text reveal animations where characters scramble through random symbols before settling into the final text, perfect for hero sections, loading states, and attention-grabbing headlines. It features intersection observer support for scroll-triggered animations, customizable speed controls, and accessibility-focused design with screen reader compatibility. Ideal for creating modern, engaging user interfaces that enhance the visual storytelling experience.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/scramble-text.json

Usage

"use client"
 
import { useRef } from "react"
 
import ScrambleText, {
  ScrambleTextHandle,
} from "@/registry/animations/scramble-text"
 
export function Component() {
  const scrambleRef = useRef<ScrambleTextHandle>(null)
 
  return (
    <div className="space-y-4">
      <ScrambleText
        ref={scrambleRef}
        text="Welcome to Delta Components"
        className="text-4xl font-bold"
        speed={120}
        onComplete={() => console.log("Animation completed!")}
      />
 
      <button
        onClick={() => scrambleRef.current?.start()}
        className="px-4 py-2 bg-primary text-primary-foreground rounded"
      >
        Replay Animation
      </button>
    </div>
  )
}

API Reference

Props

PropTypeDefaultDescription
textstring-The text that will be scrambled and displayed (required)
speednumber80Speed of the scrambling effect (higher is faster)
classNamestring""Optional custom CSS class for the container
autoStartbooleantrueWhether to start the animation automatically when mounted
useIntersectionObserverbooleanfalseWhether to use intersection observer to trigger animation when visible
retriggerOnIntersectionbooleanfalseWhether to retrigger animation when element comes into view again
intersectionThresholdnumber0.3Threshold for intersection observer (0-1)
intersectionRootMarginstring"0px"Root margin for intersection observer
scrambleOnHoverbooleanfalseWhether to scramble text on hover
onComplete() => voidundefinedCallback function when animation completes

Handle Methods

When using a ref, the component exposes these methods:

interface ScrambleTextHandle {
  start: () => void // Start/replay the scramble animation
  reset: () => void // Reset and restart the animation
}

Examples

Basic Scramble Text

Dynamic text animation with customizable scramble effect for hero sections.

Welcome to Delta Components

Intersection Observer

Text that scrambles into view when scrolled, with options for retrigger and hover effects.

Scroll to see me scramble every time

Album Track List

Cascading scramble effect showcasing multiple text elements with staggered timing.

DAMN.

Kendrick Lamar • 2017

1. BLOOD. - 1:582. DNA. - 3:053. YAH. - 2:404. ELEMENT. - 3:285. FEEL. - 3:346. LOYALTY. (feat. Rihanna) - 3:477. PRIDE. - 4:358. HUMBLE. - 2:579. LUST. - 5:0710. LOVE. (feat. Zacari) - 3:3311. XXX. (feat. U2) - 4:1412. FEAR. - 7:4013. GOD. - 4:0814. DUCKWORTH. - 4:08