NumberInput

Numeric input with stepper buttons, clamping, precision, and locale formatting

Category: inputs · WCAG 2.2-AA · form, number, input, spinbutton, stepper

Sizes

States

Props

PropTypeDefaultDescription
valuenumber | nullThe controlled value.
defaultValuenumberThe initial value when uncontrolled.
onValueChange(value: number | null) => voidFired on commit (blur, Enter, stepping); null when empty or unparseable
onChange(value: number | null) => voidDeprecated: use onValueChange (same number | null)
minnumberMinimum allowed value.
maxnumberMaximum allowed value.
stepnumber1Increment between allowed values.
precisionnumberDecimal places applied on commit
formatOptionsIntl.NumberFormatOptionsDisplay formatting applied on blur; raw editable string while focused
labelstringText label for the control.
hintstringSupplementary hint text shown with the control.
errorstringError message shown when the value is invalid.
size'sm' | 'md' | 'lg'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
disabledbooleanfalseWhen true, disables the control and removes it from the tab order.
incrementLabelstringIncrementAccessible label for the increment button.
decrementLabelstringDecrementAccessible label for the decrement button.

Design tokens

When to use

When not to use

How to build an accessible NumberInput in React →

Examples

Basic

<NumberInput label="Quantity" defaultValue={1} min={0} max={99} />

Currency

<NumberInput label="Price" precision={2} formatOptions={{ style: "currency", currency: "USD" }} />

Stepped

<NumberInput label="Opacity" min={0} max={1} step={0.1} />

Related components

← Back to docs