# M encrypted text 3

> Direction picker — buttons replay with each of four revealDirection values

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/m-encrypted-text-3).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/m-encrypted-text-3
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/m-encrypted-text-3-light-094c693817932a81.png
- Registry item: https://ui.cnippet.dev/r/m-encrypted-text-3.json
- Categories: encrypted text
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/m-encrypted-text-3.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/encrypted-text`

## Files

### `registry/default/motion-variants/m-encrypted-text-3.tsx`

```tsx
"use client";

import { useState } from "react";
import { EncryptedText } from "@/registry/default/motion/encrypted-text";

const directions = ["ltr", "rtl", "center", "random"] as const;

export default function EncryptedTextDirections() {
  const [dir, setDir] = useState<(typeof directions)[number]>("ltr");
  const [key, setKey] = useState(0);

  const replay = (d: (typeof directions)[number]) => {
    setDir(d);
    setKey((k) => k + 1);
  };

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <div className="flex h-12 items-center justify-center">
        <EncryptedText
          className="font-bold text-2xl text-foreground"
          key={key}
          maxIterations={14}
          revealDirection={dir}
          speed={45}
        >
          Cnippet Motion
        </EncryptedText>
      </div>
      <div className="flex gap-2">
        {directions.map((d) => (
          <button
            className={`rounded-md px-3 py-1.5 font-medium text-xs transition-colors ${
              d === dir
                ? "bg-foreground text-background"
                : "bg-accent text-muted-foreground hover:text-foreground"
            }`}
            key={d}
            onClick={() => replay(d)}
            type="button"
          >
            {d}
          </button>
        ))}
      </div>
    </div>
  );
}
```
