NumberPicker
A locale aware number input
Formatting#
The display format of the NumberPicker can be adjusted to provide more context
for the value it represents, such as displaying currency. The type accepted by format is
dependent on the configured localizer.
Controlling the step value#
Set the amount to increment or decrement the value when the spinner buttons are
used with the step prop.
Rounding errors#
Take care with decimal step values, JavaScript's floating point math can produce
unexpected results when adding decimals together. The NumberPicker input will
do it's best to avoid these errors, by rounding the result of a step increase to either
the precision of the current value or step amount, depending on which is larger.
You can also use the precision prop to manually control the precision used.
Keyboard Shortcuts#
API#
autoFocus#
Pass focus to the NumberPicker when it mounts.
containerClassName#
Adds a css class to the input container element.
decrementIcon#
disabled#
format#
A format string used to display the number value. Localizer dependent, read localization for more info.
incrementIcon#
inputProps#
An object of props that is passed directly to the underlying input component.
max#
The maximum number that the NumberPicker value.
messages#
Object hash containing display text and/or text for screen readers.
Use the messages object to localize widget text or provide custom rendering.
min#
The minimum number that the NumberPicker value.
name#
The HTML name attribute, passed directly to the input element.
onChange#
A callback fired when the current value changes.
onKeyDown#
The native onKeyDown event, called preventDefault will prevent any custom behavior, included keyboard shortcuts.
onKeyPress#
The native onKeyPress event, called preventDefault will stop any custom behavior.
onKeyUp#
parse#
Determines how the NumberPicker parses a number from the localized string representation.
placeholder#
Text to display in the input when the value is empty.
precision#
Specify the decimal precision of the value when incrementing or decrementing by the
step value. This may be necessary to work around rounding issues due to
floating point math. By default the precision value used will be inferred
from the step and value, rounding the result to that.
readOnly#
Controls the read-only state of the NumberPicker.
step#
Amount to increase or decrease value when using the spinner buttons.
value#
Controls the current value of the NumberPicker.