react-number-field
Version:
React Number Field
47 lines (33 loc) • 1.18 kB
Markdown
react-number-field
==================
## Install
```sh
$ npm i --save react-number-field
```
## Usage
```jsx
import NumberField from 'react-number-field'
let value = 3
<NumberField value={value} onChange={onChange} />
<NumberField defaultValue={value}/>
```
## Props
* `allowFloat: Boolean` - defaults to true. Specify `false` to only allow integers
* `allowNegative: Boolean` - defaults to true
* `minValue`
* `maxValue`
* `step: Number` - defaults to 1
* `shiftStep: Number` - defaults to 10
* `stepDelay: Number` - defaults to 40 ms
* `stepOnWheel: Boolean` - defaults to true
* `requireFocusOnStep: Boolean` - defaults to true
* `numbersOnly: Boolean` - defaults to true
* `factory: Function` - another React factory to render a different component. By default, a [`react-field`](https://www.npmjs.com/package/react-field) is rendered.
* `onChange(value, event)` - By default, the `onChange` handler will be called with the value as the first arg. If you use a `factory` function that calls `onChange` with other args, those will be passed to the `onChange`.
* `validate(newValue, char, props)`
## Development
```sh
$ npm run dev
```
## License
#### MIT