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:
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.
Prop | Type | Default | Description |
---|---|---|---|
text | string | - | Text content to decrypt |
speed | number | 50 | Animation speed in milliseconds |
maxIterations | number | 10 | Maximum scrambling iterations |
sequential | boolean | false | Reveal characters one by one |
revealDirection | 'start' | 'end' | 'center' | 'start' | Sequential reveal pattern |
useOriginalCharsOnly | boolean | false | Shuffle only original characters |
characters | string | 'ABC...xyz!@#...' | Character set for scrambling |
className | string | '' | CSS class for revealed text |
encryptedClassName | string | '' | CSS class for scrambled text |
parentClassName | string | '' | CSS class for container |
animateOn | 'view' | 'hover' | 'hover' | Animation trigger method |
Reveal Patterns
Sequential decryption direction options:
Pattern | Behavior | Best For |
---|---|---|
start | Left-to-right reveal | Reading flow, natural progression |
end | Right-to-left reveal | Dramatic effect, reverse reveals |
center | Inside-out reveal | Focal emphasis, symmetric designs |
Animation Modes
Scrambling behavior customization:
Mode | Effect | Use Case |
---|---|---|
sequential: false | All characters scramble simultaneously | Fast decryption, Matrix effect |
sequential: true | Characters reveal one by one | Typewriter effect, suspense |
useOriginalCharsOnly: true | Shuffle only original letters | Anagram 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
React Curved Loop Text
Interactive curved text animation that follows an SVG path with drag controls and smooth scrolling effects. Perfect for dynamic marquees.
React Falling Text Effect
Physics-based text animation using Matter.js that makes words fall and bounce with realistic gravity and mouse interaction. Perfect for playful interfaces.