# M splitting text 2

> Preset explorer — buttons switch all five presets on character-level split

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

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

## Install

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

## Files

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

```tsx
"use client";

import { useState } from "react";
import { SplittingText } from "@/registry/default/motion/splitting-text";

const presets = ["fade", "slide-up", "slide-down", "blur", "scale"] as const;

export default function SplittingTextPresets() {
  const [preset, setPreset] = useState<(typeof presets)[number]>("fade");
  const [key, setKey] = useState(0);

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <div className="flex h-14 items-center justify-center">
        <SplittingText
          as="p"
          className="text-center font-bold text-2xl text-foreground"
          key={key}
          preset={preset}
          splitBy="chars"
          staggerDuration={0.03}
        >
          Cnippet Motion
        </SplittingText>
      </div>
      <div className="flex flex-wrap justify-center gap-2">
        {presets.map((p) => (
          <button
            className={`rounded-md px-3 py-1.5 font-medium text-xs transition-colors ${
              p === preset
                ? "bg-foreground text-background"
                : "bg-accent text-muted-foreground hover:text-foreground"
            }`}
            key={p}
            onClick={() => {
              setPreset(p);
              setKey((k) => k + 1);
            }}
            type="button"
          >
            {p}
          </button>
        ))}
      </div>
    </div>
  );
}
```
