react-number-picker
Simple React component to pick/select a number. Can be a price selector too, if you specify currency
.
It's a way of forcing the user to choose a valid number, without using masks.
Screenshots
Install
npm install react-number-picker --save
Usage
;; ; const Wrapper = Component { superprops; thisstate = value: 199 } { console; this; } { return <NumberPicker value=thisstatevalue onChange=thishandleChange />; }; ; ReactDOM;
Styling
Don't forget to require/import style.css
from "react-number-picker/dist/style.css"
.
You can copy and customize this file. If you do some nice styling, please contribute to the project. The sass version is in the src
folder of the package.
Props
value
A numeric value. Default is 0
. Actually, it does not support negative numbers.
digits
Specify the quantity of digits you want to user select, disregarding decimal part. Default is 1
.
currency
Currency to display. Default is null
(doesn't show any).
showDecimal
Set to true
if you want to the user to be able to select two decimal values. Default is true
.
decimalSeparator
Specify the decimal separator (just visual, not internal). Default is .
.
Contributions
It's a very small project. Please feel free to contribute!