---
title: "Animated Number"
description: "Free React count up number: the value counts from zero to its target when it scrolls into view, with a custom formatter. Framer Motion, shadcn install."
category: "Components"
parent: "https://beui.dev/components/motion/number"
publishedAt: "2026-05-17"
updatedAt: "2026-11-10"
documentation: "https://beui.dev/components/motion/number/animated"
markdown: "https://beui.dev/components/motion/number/animated.md"
license: "MIT"
---

# Animated Number

> Free React count up number: the value counts from zero to its target when it scrolls into view, with a custom formatter. Framer Motion, shadcn install.

## Install

```bash
npx shadcn@latest add @beui/animated-number
```

## Dependencies

- `clsx`
- `motion`
- `react`
- `tailwind-merge`

## Usage

### Animated Number usage

Spring-driven count-up triggered when in view.

```tsx
"use client";

import { AnimatedNumber } from "@/components/motion/animated-number";

export function AnimatedNumberPreview() {
  return (
    <div className="flex flex-col items-center gap-3">
      <p className="text-xs text-muted-foreground">Monthly recurring revenue</p>
      <div className="text-4xl font-semibold tracking-tight text-foreground tabular-nums">
        <AnimatedNumber value={129480} format={(n) => `$${Math.round(n).toLocaleString()}`} />
      </div>
      <p className="text-xs text-(--color-success)">+12.4% vs last month</p>
    </div>
  );
}
```

## API Reference

### AnimatedNumber

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | `number` | — | Yes | Number to count to. Changes count from the last shown value. |
| `duration` | `number` | `1.2` | No | Length of each count, in seconds. Default: 1.2 |
| `format` | `((n: number) => string)` | `(n) => Math.round(n).toLocaleString()` | No | Formats each frame's number. Defaults to a rounded, locale-grouped integer. |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `startOnView` | `boolean` | `true` | No | Wait until the number scrolls into view before counting. Default: true |

## More in Number Animation

- [Digit Swap](https://beui.dev/components/motion/number/digit-swap.md)
- [Number Ticker](https://beui.dev/components/motion/number/ticker.md)

## Source

- Registry detail: https://beui.dev/r/animated-number
- Raw source: https://beui.dev/r/animated-number/raw
- GitHub: https://github.com/starc007/ui-components
