The BasicNumberTicker component creates a smooth, animated numeric transition from a starting value to a target value. Leveraging Framer Motion's robust layout engines, it provides precise control over speed, easing, and timing, making it perfect for dynamic statistics, growth metrics, and dashboards.
Preview
0%
Installation
$ npx shadcn@latest add https://spark-ui-olive.vercel.app/r/basic-number-ticker.json
Usage
import NumberTicker from "@/components/basic-number-ticker";export default function BasicNumberTickerDemo() {
return (
<div className="flex items-center justify-center">
<span className="text-5xl sm:text-6xl font-normal text-zinc-900 dark:text-zinc-50 font-mono">
<NumberTicker from={0} target={99} />
<span>%</span>
</span>
</div>
);
}Variants Preview
Avg. Latency
1.2s linear transition
10ms
Uptime Guarantee
2.5s easeOut transition
90%
Deployments
Manual trigger
+0
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
from | number | 0 | The starting numeric value of the animation. |
target | number | 100 | The target numeric value to count up or down to. |
transition | ValueAnimationTransition | { duration: 3, type: "tween", ease: "easeInOut" } | Animation configuration, matching standard Framer Motion animation properties (tween/spring, duration, ease, etc.). |
className | string | — | Additional CSS classes for custom styling. |
onStart | () => void | — | Callback function invoked when the animation begins. |
onComplete | () => void | — | Callback function invoked when the animation finishes. |
autoStart | boolean | true | If true, start the count animation automatically when mounted. |