NumberInput is an Input for a number. The − and + buttons step the value by step and stop at min and max. Typing works too, and onChange gets a number whenever the text reads as one. The keyboard is a number pad, with a minus key when min allows negative numbers. See the web NumberInput for the browser version.
Without value the field keeps its own text, starting from defaultValue.
Pass value and update it in onChange. A new value from outside replaces the text, unless the text already reads as that number, so typing 1. is not undone.
A fractional step rounds each step to its decimals, so 0.1 + 0.2 shows as 0.3. padStart pads the number with leading zeros.
- The steppers are a − and a + button after the value, sized for a finger, instead of two small chevrons stacked on the right edge.
- A stepper is disabled when its next step would pass min or max. On the web it stays enabled and does nothing.
- Steps are rounded to the decimals of step, so fractional steps do not show floating-point noise.
- keyboardType defaults to a number pad: decimal-pad when min is 0 or more, otherwise a keyboard with a minus key. Pass keyboardType to change it.
- suffix is taken by the steppers, as on the web. The other Input props work as on Input.