Encrypt Text is a React text effect that scrambles each character through a pool of random glyphs — letters, digits, symbols — before settling on the target string. Settling fans out left-to-right so the final text reveals itself progressively, and whitespace is held constant so word shapes stay legible while surrounding letters are still scrambling.
Trigger it on mount, on hover, the first time it scrolls into view, or manually.
Installation
Usage
import { EncryptText } from "@/components/ui/encrypt-text";
export function Example() {
return <EncryptText text="DESIGN SHARP · SHIP FAST" />;
}Hover to replay
<EncryptText text="hover me" trigger="hover" />Reveal on scroll into view
<EncryptText text="sliding into view…" trigger="inView" />Custom character pool
<EncryptText text="HELLO" chars="01" tickMs={40} />
// → scrambles through 0s and 1s onlyPlay manually from a ref
const ref = useRef<EncryptTextHandle>(null);
<EncryptText ref={ref} text="ACCESS GRANTED" trigger="manual" />
<button onClick={() => ref.current?.play()}>Decrypt</button>Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | — | The final text to settle on. |
chars | string | letters + digits + symbols | Pool of characters to sample while scrambling. |
tickMs | number | 55 | Milliseconds between scramble frames. |
revealSeconds | number | 0.9 | Total seconds over which the full reveal fans out. |
trigger | "mount" | "hover" | "inView" | "manual" | "mount" | When to play the scramble. |
startDelay | number | 0 | Delay in ms before the first play. |
as | ElementType | "span" | Element to render. |
className | string | — | Extra classes. |
scrambleClassName | string | "opacity-40" | Classes for characters still scrambling. |
Related components
- Animated Text
Text with various animation effects and transitions.
- Ascii Text
Renders text as animated ASCII block letters, with wave, scan, glitch, typewriter and pulse modes.
- Flip Text
Splits text into characters that roll up and away on hover while a duplicate layer flips in from below, staggered letter by letter.
- Glow Card
A card component with subtle animation and transitions.
