react numeral input
npm install react-numeral-inputIt is a very tiny component which is a replacement of HTML input element for post-editing format of number values.
ex. 1000000 -> 1,000,000

* React.js
* Numeral.js
``shell`
npm install react-numeral-input
`jsx
// replace original input from
// like this
`
`jsx
let NumeralInput = require('react-numeral-input');
module.exports = React.createClass({
getInitialState() {
return {
numeralVal: 1000000
}
},
onChange(val){
this.setState( {numeralVal:val});
},
render() {
return (
className="form-control"
placeholder=""
onChange={this.onChange} />
)
}
});
`
`jsx``
Default: "0,0"
It is passed to configure numeral format, You can find more information from Numeral.js.
Callback when value is changed, you will receieve unformated number (1000000 instead of 1,000,000).