A spinning dial counter for React, similar to price spinners in the Robinhood stock app.
npm install --save react-bean-counter
git clone [email protected]:BirdTho/react-bean-counter.git
cd react-bean-counter
npm install
npm run storybook
import React from 'react'
import BeanCounter from 'react-bean-counter'
class Example extends Component {
render() {
return <BeanCounter value={1234.56} precision={2} className='custom-bean-style'/>
}
}
BeanCounter
will automatically calculate metrics of digits based on the size of the font. It uses an offscreen element to measure digit dimensions for a given font and font size.
For instance, you can pass in custom class name to the BeanCounter using the optional className
parameter.
.custom-bean-style {
font-size: 16px;
font-family: Helvetica, sans-serif;
color: white;
}
.custom-bean-style > span, .custom-bean-style .bean-digit-container {
background-color: rgb(30, 30, 30);
}
MIT © BirdTho