# M counting number 2

> Large hero metric — single full-width counter with imperative replay via ref

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

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

## Install

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

## Files

### `registry/default/motion-variants/m-counting-number-2.tsx`

```tsx
"use client";

import { useRef } from "react";
import {
  CountingNumber,
  type CountingNumberRef,
} from "@/registry/default/motion/counting-number";

export default function CountingNumberHero() {
  const ref = useRef<CountingNumberRef>(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-medium text-muted-foreground text-sm uppercase tracking-widest">
          Total revenue processed
        </p>
        <p className="mt-2 font-bold text-6xl text-foreground tracking-tight sm:text-7xl">
          $
          <CountingNumber
            autoStart={true}
            from={0}
            ref={ref}
            target={2847593}
            transition={{ duration: 2.5, ease: "easeOut", type: "tween" }}
          />
        </p>
      </div>
      <button
        className="rounded-full bg-accent px-5 py-2 font-medium text-foreground text-sm hover:bg-accent/80"
        onClick={() => ref.current?.startAnimation()}
        type="button"
      >
        Replay
      </button>
    </div>
  );
}
```
