Skip to content

COMPONENT / decrypt-text

Decrypt Text_

Random glyphs that resolve left to right into the real string once on mount; screen readers get the real string. Requires @cybr/tokens.

Install

  1. 1. Map the @cybr namespace, once per project. Add this inside your components.json, or into its existing "registries" object. No components.json yet? Run npx shadcn@latest init first to create one.

    "registries": { "@cybr": "https://cybr-ui.com/r/{name}.json" }
  2. 2. Add components:

    $ npx shadcn@latest add @cybr/decrypt-text

If shadcn reports Unknown registry "@cybr", step 1 is missing from that project's components.json.

Preview

ACCESS GRANTED

Props

Component props
PropTypeDefaultDescription
textstring—The real string. Shown scrambled, then resolved, and always exposed to screen readers as-is.
classNamestring—Extra classes, merged after the defaults with cn().
...propsOmit<ComponentProps<"span">, "children">—Every other native <span> attribute and ref is forwarded.

Usage

Needs the stylesheet from @cybr/tokens, and @cybr/use-reduced-motion arrives with it. After the install, import the tokens in app/globals.css:

@import "tailwindcss";
@import "../styles/cybr-tokens.css";
import { DecryptText } from "@/components/ui/decrypt-text";

export function Banner() {
  return (
    <h1 className="font-display text-6xl uppercase">
      <DecryptText text="ACCESS GRANTED" />
    </h1>
  );
}

Behaviour

Accessibility