# Number Ticker

> Counts up to a value with an eased finish when it scrolls into view.

Category: Text · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/number-ticker

## When to use it

Stats bands, social proof ("12,000 teams"), results on case studies and dashboard headlines.

## How it works

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.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/number-ticker.json
```

Or copy `components/motionkit/number-ticker.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| 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. |

## Accessibility

- **Keyboard: Not applicable.** Text only, nothing to focus.
- **Screen readers: Pass.** Screen readers hear the final value only, never the in-between numbers.
- **Reduced motion: Pass.** With reduced motion on, the final value shows immediately.
- **Colour contrast: Not applicable.** Uses whatever text colour you pass in className.

## Source

```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>
  );
}
```
