react-numeral-input
It is very tiny commponent which is a replacement of HTML input element for post-editing format of number values.
ex. 1000000 -> 1,000,000
Dependency
install
npm install react-numeral-input
Usage
<input value={this.state.numeralVal} className="" placeholder="" onChange={this.onChange} />
<NumeralInput value={this.state.numeralVal} className="" placeholder="" onChange={this.onChange} />
complete example
let NumeralInput = require('react-numeral-input');
module.exports = React.createClass({
getInitialState() {
return {
numeralVal: 1000000
}
},
onChange(val){
this.setState( {numeralVal:val});
},
render() {
return (
<NumeralInput
value={this.state.numeralVal}
className="form-control"
placeholder=""
onChange={this.onChange} />
)
}
});