Join our Discord Community

React Decrypted Text Effect

Matrix-style text decryption animation with character scrambling, sequential reveal patterns, and customizable trigger modes. Perfect for cyberpunk interfaces.

Want to add decryption effects to your text?

Join our Discord community for help from other developers.


Most text reveal effects use simple fade-ins or slide animations that feel predictable and lack the technical aesthetic of decryption. This component creates Matrix-style character scrambling effects that simulate text being decrypted in real-time with customizable patterns and triggers.

Matrix-style text decryption

Text that scrambles through random characters before revealing the final message:

Loading component...

Built with TypeScript for React applications, using Framer Motion for smooth animations and intelligent character shuffling algorithms with multiple reveal patterns and accessibility support.

Installation

npx shadcn@latest add https://www.shadcn.io/registry/decrypted-text.json
npx shadcn@latest add https://www.shadcn.io/registry/decrypted-text.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/decrypted-text.json
bunx shadcn@latest add https://www.shadcn.io/registry/decrypted-text.json

Usage

import DecryptedText from "@/components/text/decrypted-text";

<div className="flex items-center justify-center min-h-screen w-full p-4 sm:p-8">
  <div className="text-center space-y-8">
    <DecryptedText 
      text="Hover to decrypt"
      speed={60}
      maxIterations={15}
      sequential={false}
      className="text-4xl font-bold text-foreground"
      encryptedClassName="text-4xl font-bold text-muted-foreground"
      animateOn="hover"
    />
  </div>
</div>

Why simple reveals aren't enough

Traditional text animations use linear reveals or basic transitions—approaches that don't capture the sophisticated, technical feeling of data being processed or decrypted. Simple fade effects lack the dynamic, unpredictable quality that makes cyberpunk aesthetics compelling.

This React component simulates realistic text decryption by scrambling characters through random sequences before revealing the final message. Multiple reveal patterns including sequential character-by-character decryption and simultaneous scrambling create the feeling of data being processed by advanced algorithms.

The key insight: decryption should feel computational. When text reveals through character-level scrambling with algorithmic patterns, it creates more convincing technical aesthetics than simple opacity or position changes.

Features

  • Matrix-style character scrambling with customizable character sets and intelligent shuffling algorithms
  • Multiple reveal patterns including sequential start/end/center reveals and simultaneous decryption modes
  • Flexible trigger system supporting hover interactions, scroll-based reveals, and automatic animations
  • Advanced character management with original character preservation and custom encryption alphabets
  • Accessibility-first design with screen reader support and semantic markup structure
  • Performance optimized with interval-based updates and automatic cleanup mechanisms
  • Free open source component compatible with Next.js and shadcn/ui design systems

API Reference

DecryptedText

Matrix-style text decryption component with customizable patterns.

PropTypeDefaultDescription
textstring-Text content to decrypt
speednumber50Animation speed in milliseconds
maxIterationsnumber10Maximum scrambling iterations
sequentialbooleanfalseReveal characters one by one
revealDirection'start' | 'end' | 'center''start'Sequential reveal pattern
useOriginalCharsOnlybooleanfalseShuffle only original characters
charactersstring'ABC...xyz!@#...'Character set for scrambling
classNamestring''CSS class for revealed text
encryptedClassNamestring''CSS class for scrambled text
parentClassNamestring''CSS class for container
animateOn'view' | 'hover''hover'Animation trigger method

Reveal Patterns

Sequential decryption direction options:

PatternBehaviorBest For
startLeft-to-right revealReading flow, natural progression
endRight-to-left revealDramatic effect, reverse reveals
centerInside-out revealFocal emphasis, symmetric designs

Animation Modes

Scrambling behavior customization:

ModeEffectUse Case
sequential: falseAll characters scramble simultaneouslyFast decryption, Matrix effect
sequential: trueCharacters reveal one by oneTypewriter effect, suspense
useOriginalCharsOnly: trueShuffle only original lettersAnagram effect, word puzzles

Common gotchas

Performance with long text: Each character update triggers a re-render. For very long text (500+ characters), consider breaking into smaller components or increasing the speed interval to reduce update frequency.

Character set customization: The default character set includes letters, numbers, and symbols. For specific aesthetics, customize the characters prop but ensure it includes enough variety for convincing scrambling effects.

Accessibility considerations: The component includes screen reader support via sr-only content, but rapid character changes can be disorienting. Consider respecting prefers-reduced-motion to disable scrambling.

Memory leaks with intervals: The component automatically cleans up intervals, but rapid prop changes might cause issues. Avoid frequently changing props during active animations.

Sequential timing issues: Very fast speeds (< 30ms) with sequential mode might cause visual glitches on slower devices. Test across different performance levels to find optimal settings.

Integration with other components

Perfect for cyberpunk-themed interfaces, security dashboards, or technical demonstrations in Card layouts. The decryption effect works excellently as loading states or data processing indicators.

For gaming interfaces or sci-fi applications, combine with other technical effects like glitch text or particle systems. The component pairs well with Badge components for status indicators with decryption reveals and works beautifully in Dialog modals for dramatic data reveals.

Questions developers actually ask