node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

react-number-field

react-number-field

Install

$ npm i --save react-number-field

Usage

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 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

$ npm run dev

License

MIT