Animated Number
Animated Number is a React and Tailwind CSS text component from Motion Primitives, licensed MIT. Copy it and paste it into your project.
Motion Primitives
MIT
text
What it is
Animated Number is a React and Tailwind CSS text 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.
Four free copies a week. No card.
Needs
npm i lucide-react
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.
Animated Number
'use client';
import { useState } from 'react';
import { AnimatedNumber } from '@/components/core/animated-number';
import { Minus, Plus } from 'lucide-react';
export function AnimatedNumberCounter() {
const [value, setValue] = useState(1000);
return (
<div className='flex w-full items-center justify-center space-x-2 text-zinc-800 dark:text-zinc-50'>
<button
aria-label='Decrement'
onClick={() => setValue((prev) => prev - 100)}
>
<Minus className='h-4 w-4' />
</button>
<AnimatedNumber
className='inline-flex items-center font-mono text-2xl font-light'
springOptions={{
bounce: 0,
duration: 1000,
}}
value={value}
/>
<button
aria-label='Increment'
onClick={() => setValue((prev) => prev + 100)}
>
<Plus className='h-4 w-4' />
</button>
</div>
);
}