Decrypted Text

Cycles through cryptographic glyphs before locking each character sequentially into its final string—ideal for developer telemetry labels and hero accents.

#cipher#scramble#monospace#hover
Hover or click badge to re-scramble

Customize

45ms
#FF9FFC
Sequential Lock

Installation

$pnpm dlx yourbrand@latest add @yourbrand/DecryptedText-TS-TW
Usage (synced with live props)
<DecryptedText
  text="SYSTEM READY // 01"
  speed={45}
  accentColor="#FF9FFC"
  sequential
/>

Source Code

DecryptedText.tsx
"use client";

import React from "react";

export interface DecryptedTextProps {
  text?: string;
  speed?: number;
  accentColor?: string;
  sequential?: boolean;
}

export function DecryptedText({
  text = "SYSTEM READY // 01",
  speed = 45,
  accentColor = "#FF9FFC",
  sequential = true,
}: DecryptedTextProps) {
  const [display, setDisplay] = React.useState(text);
  const runDecode = React.useCallback(() => {
    const glyphs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/#*";
    let step = 0;
    const id = window.setInterval(() => {
      step += 1;
      setDisplay(
        text
          .split("")
          .map((ch, idx) => {
            if (ch === " ") return " ";
            if (sequential ? idx < step : step > 10) return ch;
            return glyphs[(idx + step * 3) % glyphs.length];
          })
          .join("")
      );
      if (step > text.length + 4) window.clearInterval(id);
    }, speed);
    return () => window.clearInterval(id);
  }, [text, speed, sequential]);

  React.useEffect(() => runDecode(), [runDecode]);

  return (
    <button
      type="button"
      onMouseEnter={runDecode}
      className="font-mono text-2xl font-medium tracking-wider text-white"
      style={{ textShadow: `0 0 24px ${accentColor}44` }}
    >
      {display}
    </button>
  );
}

Props API

PropTypeDefaultDescription
textstring"SYSTEM READY // 01"Final decoded string.
speednumber45Scramble refresh rate.
accentColorstring (hex)"#FF9FFC"Color of actively scrambling glyphs.
sequentialbooleantrueReveal left-to-right instead of all at once.