# M text rotate 2

> Manual step control — prev/next buttons drive word-by-word rotation via ref

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

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

## Install

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

## Files

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

```tsx
"use client";

import { useRef } from "react";
import {
  TextRotate,
  type TextRotateRef,
} from "@/registry/default/motion/text-rotate";

const steps = [
  "Pick a component",
  "Run the CLI",
  "Customise props",
  "Ship to production",
];

export default function TextRotateManual() {
  const ref = useRef<TextRotateRef>(null);

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <div className="text-center">
        <p className="font-semibold text-muted-foreground text-xs uppercase tracking-widest">
          How it works
        </p>
        <TextRotate
          as="h2"
          auto={false}
          mainClassName="mt-2 justify-center text-2xl font-bold text-foreground sm:text-3xl"
          ref={ref}
          splitBy="words"
          staggerDuration={0.06}
          staggerFrom="first"
          texts={steps}
          transition={{ damping: 20, stiffness: 200, type: "spring" }}
        />
      </div>
      <div className="flex gap-2">
        <button
          className="rounded-md bg-accent px-3 py-1.5 font-medium text-foreground text-sm hover:bg-accent/80"
          onClick={() => ref.current?.previous()}
          type="button"
        >
          ← Prev
        </button>
        <button
          className="rounded-md bg-foreground px-3 py-1.5 font-medium text-background text-sm hover:bg-foreground/80"
          onClick={() => ref.current?.next()}
          type="button"
        >
          Next →
        </button>
      </div>
    </div>
  );
}
```
