# react-animated-numbers

> Library showing animation of number changes in react.js

Latest version **1.1.1** (published 2025-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-animated-numbers
pnpm add react-animated-numbers
yarn add react-animated-numbers
bun add react-animated-numbers
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2025-06-17 |
| First published | 2020-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 303 |
| Author | youngsoohan |
| Maintainers | youngsoohan |
| Keywords | react, react-native, animation, animated, numbers, number, spring |

## Links

- npm: https://www.npmjs.com/package/react-animated-numbers
- Repository: https://github.com/heyman333/react-animated-numbers
- Homepage: https://optimistic-noyce-cf2473.netlify.app/
- Issues: https://github.com/heyman333/react-animated-numbers/issues
- npm.io page: https://npm.io/package/react-animated-numbers

## Dependencies (1)

- [motion](https://npm.io/package/motion.md) ^11.16.0

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2025-06-17
- 1.1.0 — 2025-06-06
- 1.0.1 — 2025-03-31
- 1.0.0 — 2025-01-08
- 0.18.0 — 2024-01-27
- 0.17.1 — 2023-11-19
- 0.17.0 — 2023-11-19
- 0.16.0 — 2023-02-22
- 0.15.0 — 2023-01-31
- 0.14.0 — 2022-08-24
- 0.13.0 — 2022-06-06
- 0.12.2 — 2022-05-15
- 0.12.1 — 2022-05-15
- 0.12.0 — 2022-05-15
- 0.11.0 — 2022-04-02
- … 25 more at https://npm.io/package/react-animated-numbers/versions

## README

<a href="https://www.npmjs.com/package/react-animated-numbers">
<img alt="npm version" src="http://img.shields.io/npm/v/react-animated-numbers.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/react-animated-numbers">
<img src="http://img.shields.io/npm/dm/react-animated-numbers.svg?style=flat-square">
</a>

# react-animated-numbers

Library showing animation of number changes in react.js

## Props

|         name          |               type               | default | description                                                                                                                                    |
| :-------------------: | :------------------------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|    animateToNumber    |              number              |  none   | Number to be animated                                                                                                                          |
|       fontStyle       |       React.CSSProperties?       |  none   | Style of number text                                                                                                                           |
| useThousandsSeparator |             boolean?             |  false  | A value that determines whether to show a comma or not.                                                                                        |
|        locale         |             string?              |  en-US  | Formats animated number as per locale. Also it should be used with `inculdeComma` prop. For list of locales, search for "BCP 47 language tags" |
|      transitions      | (index: number) => Transition$1? |  none   | framer-motion [transitions](https://www.framer.com/motion/transition/). The order of numbers shown is passed as a parameter.                   |
|       className       |             string?              |  none   | ClassName for style                                                                                                                            |

### Next JS (< v13.x.x )

You have to use dynamic imports to ensure that this library is imported on the client side only.

Import the library like this:

```
import dynamic from "next/dynamic";
const AnimatedNumbers = dynamic(() => import("react-animated-numbers"), {
  ssr: false,
});
```

Credit to @jedwardblack for [this](https://github.com/heyman333/react-animated-numbers/issues/40)

### Next JS (>= v13.x.x )

Use the library like this:

```
"use client";

import AnimatedNumbers from "react-animated-numbers"
```

### Example

```jsx
import React from "react";
import AnimatedNumbers from "react-animated-numbers";
import "./App.css";

function App() {
  const [num, setNum] = React.useState(331231);
  return (
    <div className="container">
      <AnimatedNumbers
        useThousandsSeparator
        className={styles.container}
        transitions={(index) => ({
          type: "spring",
          duration: index + 0.3,
        })}
        animateToNumber={number}
        fontStyle={{
          fontSize: 40,
          color: "red",
        }}
      />
      <div>
        <button onClick={() => setNum((state) => state + 31234)}>+</button>
        <button onClick={() => setNum((state) => state - 31234)}>-</button>
      </div>
    </div>
  );
}

export default App;
```

### GIF

![test](./images/animated-numbers.gif)

## Todo

- [ ] test code
- [x] start animation when dom is visible

---
_Source: https://npm.io/package/react-animated-numbers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
