# M text morph 1

> Word cycler — button group drives character-level morphing between words

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

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

## Install

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

## Files

### `registry/default/motion-variants/m-text-morph-1.tsx`

```tsx
"use client";

import { useState } from "react";
import { TextMorph } from "@/registry/default/motion/text-morph";

const words = ["Innovate", "Collaborate", "Accelerate", "Automate"];

export default function TextMorphCycler() {
  const [index, setIndex] = useState(0);

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <h2 className="text-center font-bold text-4xl text-foreground tracking-tight sm:text-5xl">
        <TextMorph>{words[index] ?? words[0] ?? ""}</TextMorph>
      </h2>
      <div className="flex gap-2">
        {words.map((word, i) => (
          <button
            className={`rounded-md px-3 py-1 font-medium text-sm transition-colors ${
              i === index
                ? "bg-foreground text-background"
                : "bg-accent text-muted-foreground hover:text-foreground"
            }`}
            key={word}
            onClick={() => setIndex(i)}
            type="button"
          >
            {word}
          </button>
        ))}
      </div>
    </div>
  );
}
```
