Skip to content
JavaScript CSS
Branch: master
Clone or download
Latest commit fe907ba Oct 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets 💄 improve default style Feb 20, 2019
examples Added aria-labels to all of the InputNumber examples so that they wil… Oct 10, 2019
src Dynamic setting max prop Oct 15, 2019
tests add test cases Oct 15, 2019
.editorconfig input number Apr 15, 2015
.eslintrc Fix focus shown in ant-design #10663 (#106) Jun 13, 2018
.gitignore Ignore es dir Nov 7, 2017
.travis.yml 3.6.5 Aug 17, 2017 4.5.0 Aug 19, 2019 Added Dec 21, 2016 Add props.onPressEnter only Aug 19, 2019
package.json 4.5.1 Oct 15, 2019


input number ui component for react

NPM version build status Test coverage david-dm deps devDependencies Status node version npm download





var InputNumber = require('rc-input-number');
var React = require('react');
var ReactDOM = require('react-dom');
ReactDOM.render(<InputNumber defaultValue={19}/>, container);


npm install
npm start


online example:



name type default description
prefixCls string rc-input-number Specifies the class prefix
min Number Specifies the minimum value
placeholder string
max Number Specifies the maximum value
step Number or String 1 Specifies the legal number intervals
precision Number Specifies the precision length of value
disabled Boolean false Specifies that an InputNumber should be disabled
focusOnUpDown Boolean true whether focus input when click up or down button
required Boolean false Specifies that an InputNumber is required
autoFocus Boolean false Specifies that an InputNumber should automatically get focus when the page loads
readOnly Boolean false Specifies that an InputNumber is read only
name String Specifies the name of an InputNumber
id String Specifies the id of an InputNumber
value Number Specifies the value of an InputNumber
defaultValue Number Specifies the defaultValue of an InputNumber
onChange Function Called when value of an InputNumber changed
onPressEnter Function The callback function that is triggered when Enter key is pressed.
onFocus Function Called when an element gets focus
style Object root style. such as {width:100}
upHandler React.Node custom the up step element
downHandler React.Node custom the down step element
formatter (value: number|string): displayValue: string Specifies the format of the value presented
parser (displayValue: string) => value: number `input => input.replace(/[^\w\.-]*/g, '')` Specifies the value extracted from formatter
pattern string Specifies a regex pattern to be added to the input number element - useful for forcing iOS to open the number pad instead of the normal keyboard (supply a regex of "\d*" to do this) or form validation
decimalSeparator string Specifies the decimal separator

Keyboard Navigation

  • When you hit the or key, the input value will be increased or decreased by step
  • With the Shift key (Shift+⬆, Shift+⬇), the input value will be changed by 10 * step
  • With the Ctrl or key (Ctrl+⬆ or ⌘+⬆ or Ctrl+⬇ or ⌘+⬇ ), the input value will be changed by 0.1 * step

Test Case

npm test
npm run chrome-test


npm run coverage

open coverage/ dir


rc-input-number is released under the MIT license.

You can’t perform that action at this time.