A configurable React component wrapper around CountUp.js to count up numbers.
Check out the live demo.
Make sure you have a compatible version of React 0.14.x
and 15.x.x
installed in your project.
npm install react-countup --save
import React from 'react';
import { render } from 'react-dom';
import CountUp from 'react-countup';
render(
<CountUp start={0} end={160526} />,
document.getElementById('root')
);
import React from 'react';
import { render } from 'react-dom';
import CountUp from 'react-countup';
const onComplete = () => {
// Do something on completion
};
render(
<CountUp
className="custom-count"
start={160527.0127}
end={-875}
duration={2.75}
useEasing={true}
separator=" "
decimal=","
prefix="EUR "
suffix=" left"
callback={onComplete}
/>,
document.getElementById('root'),
);
The start number from which the should start from
Target number to count up
Duration of count up animation
Amount of decimals
use "easeOutExpo" if true
group thousands by separator character
Specifies character of thousands separator
Specifies decimal character
Static text before the animating value
Static text after the animating value
CSS class to be applied to the wrapper containing the number.
Callback function to be triggered after completed count up animation
MIT