Words lift out of a blur one after another as the line scrolls into view.
Counts up to a value with an eased finish when it scrolls into view.
Monthly revenue
Customize
Usage
import { NumberTicker } from "@/components/motionkit/number-ticker";
<NumberTicker value={48200} prefix="$" />Motion
The exact curves this component runs, plotted with Motion's own maths.
Count up
Scrolls into view
Stats bands, social proof ("12,000 teams"), results on case studies and dashboard headlines.
useInView waits until the whole number is on screen, then Motion animates a value from 0 to your target with a strong ease-out, so it slows down as it lands. Each frame is formatted with toLocaleString, so separators and decimals are right for the locale. Screen readers hear only the final value.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/number-ticker.jsonnpm install motionSave as components/motionkit/number-ticker.tsx.
"use client";
import { useEffect, useRef } from "react";
import { animate, motion, useInView, useMotionValue, useReducedMotion, useTransform } from "motion/react";
type NumberTickerProps = {
value: number;
/** Seconds to count up. */
duration?: number;
decimals?: number;
prefix?: string;
suffix?: string;
/** BCP 47 locale used for thousands separators. */
locale?: string;
className?: string;
};
export function NumberTicker({
value,
duration = 1.6,
decimals = 0,
prefix = "",
suffix = "",
locale = "en-US",
className = "",
}: NumberTickerProps) {
const ref = useRef<HTMLSpanElement>(null);
// wait until the whole number is on screen: counting as soon as a sliver peeks in
// means the count is over before anyone has scrolled far enough to see it
const inView = useInView(ref, { once: true, amount: "all" });
const reduceMotion = useReducedMotion();
const count = useMotionValue(0);
const format = (number: number) =>
`${prefix}${number.toLocaleString(locale, {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
})}${suffix}`;
const formatted = useTransform(count, format);
useEffect(() => {
if (!inView) return;
if (reduceMotion) {
count.set(value);
return;
}
const controls = animate(count, value, { duration, ease: [0.16, 1, 0.3, 1] });
return () => controls.stop();
}, [inView, value, duration, reduceMotion, count]);
return (
<span ref={ref} className={`tabular-nums ${className}`}>
{/* screen readers hear the final value, not every frame of the count */}
<motion.span aria-hidden>{formatted}</motion.span>
<span className="sr-only">{format(value)}</span>
</span>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | — | The number to count to. |
| duration | number | 1.6 | Seconds to count up. |
| decimals | number | 0 | Fixed decimal places. |
| prefix / suffix | string | "" | Text before and after the number. |
| locale | string | "en-US" | Locale used for thousands separators. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/number-ticker.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, the final value shows immediately.
Words lift out of a blur one after another as the line scrolls into view.
An airport departures board: every tile flips through its drum, one character at a time, to land on your text.
Headlines that arrive word by word or letter by letter: slide, blur, hinge or rise from behind a mask, from any direction.