numeral-react
v1.0.0
Published
Numeral React Input
Downloads
9
Maintainers
Readme
numeral-react
It 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
Dependency
- React
- Numeral.js
Install
yarn add numeral numeral-react
Usage
<NumeralReact
onChange={(event, value) => {
console.info(value)
}}
/>
Options
You can set any original input props such as format and onChange. For example:
<NumeralReact className="" placeholder="" format="0,0" onChange={onChange} />
format: string
Default: "0,0"
It is passed to configure numeral format, You can find more information from Numeral.js.
onChange: function(event: React.ChangeEvent, value: number)
Callback when value is changed, you will receieve unformated number (1000000 instead of 1,000,000).