All components

Sliding Number Counter

Sliding Number Counter is a React and Tailwind CSS component from Motion Primitives, licensed MIT. Copy it and paste it into your project.

Motion Primitives MIT other

What it is

Sliding Number Counter is a React and Tailwind CSS component from Motion Primitives, licensed MIT. Copy it and paste it into your project.

How to use it

Open it in the catalogue, press copy, and paste it into your project. The prompt you copy carries the code and the rules that tell your agent to reproduce it without changing anything.

Open in the catalogue

Four free copies a week. No card.

No packages beyond the project baseline

Licence

This component comes from Motion Primitives and is redistributed under the MIT licence, which permits commercial use. The copyright notice travels with the code.

Sliding Number Counter

app/docs/sliding-number/clock.tsx
'use client';
import { SlidingNumber } from '@/components/core/sliding-number';
import { useEffect, useState } from 'react';

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

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

  return (
    <div className='flex items-center gap-0.5 font-mono'>
      <SlidingNumber value={time.getHours()} padStart={true} />
      <span className='text-zinc-500'>:</span>
      <SlidingNumber value={time.getMinutes()} padStart={true} />
      <span className='text-zinc-500'>:</span>
      <SlidingNumber value={time.getSeconds()} padStart={true} />
    </div>
  );
}

Similar components