# M sliding number 2

> Live clock — hours, minutes, seconds as separate padded sliding numbers

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

- Page, with a live preview: https://shadcn.exchange/r/cnippet/m-sliding-number-2
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/m-sliding-number-2-light-ce34481e7dbb40ed.png
- Registry item: https://ui.cnippet.dev/r/m-sliding-number-2.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-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/sliding-number`

## Files

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

```tsx
"use client";

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

function _pad(n: number) {
  return n;
}

export default function SlidingNumberClock() {
  const [time, setTime] = useState(new Date());

  useEffect(() => {
    const id = setInterval(() => setTime(new Date()), 1000);
    return () => clearInterval(id);
  }, []);

  const h = time.getHours();
  const m = time.getMinutes();
  const s = time.getSeconds();

  return (
    <div className="flex min-h-50 items-center justify-center px-6">
      <div className="flex items-center gap-1 font-bold font-mono text-5xl text-foreground tabular-nums">
        <SlidingNumber padStart value={h} />
        <span className="mb-1 text-muted-foreground">:</span>
        <SlidingNumber padStart value={m} />
        <span className="mb-1 text-muted-foreground">:</span>
        <SlidingNumber padStart value={s} />
      </div>
    </div>
  );
}
```
