# M text scramble 2

> Click to retrigger — manually replays the scramble via trigger prop

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

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

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/m-text-scramble-2.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/text-scramble`

## Files

### `registry/default/motion-variants/m-text-scramble-2.tsx`

```tsx
"use client";

import { useState } from "react";
import { TextScramble } from "@/registry/default/motion/text-scramble";

export default function TextScrambleTrigger() {
  const [trigger, setTrigger] = useState(true);

  function handleClick() {
    setTrigger(false);
    setTimeout(() => setTrigger(true), 50);
  }

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <TextScramble
        as="p"
        className="font-medium font-mono text-foreground text-xl uppercase tracking-widest"
        duration={0.8}
        speed={0.04}
        trigger={trigger}
      >
        Decrypt on demand
      </TextScramble>
      <button
        className="rounded-md border border-border bg-background px-4 py-1.5 text-muted-foreground text-sm transition-colors hover:bg-accent hover:text-foreground"
        onClick={handleClick}
        type="button"
      >
        Scramble again
      </button>
    </div>
  );
}
```
