# M sliding number 1

> Increment/decrement — +/- buttons drive a single odometer display

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

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

## Install

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

## Files

### `registry/default/motion-variants/m-sliding-number-1.tsx`

```tsx
"use client";

import { useState } from "react";
import { SlidingNumber } from "@/registry/default/motion/sliding-number";

export default function SlidingNumberCounter() {
  const [count, setCount] = useState(0);

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <div className="flex items-baseline gap-1 font-bold text-6xl text-foreground tabular-nums">
        <SlidingNumber value={count} />
      </div>
      <div className="flex gap-2">
        <button
          className="rounded-md border border-border px-4 py-2 font-medium text-foreground text-sm hover:bg-accent"
          onClick={() => setCount((c) => Math.max(0, c - 1))}
          type="button"
        >
          −
        </button>
        <button
          className="rounded-md bg-foreground px-4 py-2 font-medium text-background text-sm hover:bg-foreground/80"
          onClick={() => setCount((c) => c + 1)}
          type="button"
        >
          +
        </button>
      </div>
    </div>
  );
}
```
