NumberInput

React numeric input with plus and minus steppers, min, max, step, and decimal support. Holds number or null, wires label and error states, and stays LTR in Arabic.

NumberInput holds number | null. min/max clamp the value, step sizes the increment, and hideControls removes the buttons.

When to use

Use NumberInput for quantities and counts the user might nudge: number of dependents, items, or years. min and max clamp the value and step sizes each increment, which suits fees and decimal amounts.

Use TextInput with inputMode="numeric" for identifiers such as national IDs or phone numbers, because those are digits, not numbers. Set hideControls when steppers add noise in dense forms.

Examples

Quantity

Bounded with helper text

Decimal step & subtle steppers

Error & no steppers

Props

Props declared by NumberInput. Native attributes of the underlying element pass through.

PropTypeDefaultDescription
size"md" | "lg"
variant"default" | "filled-lighter" | "filled-darker"
stepperVariant"solid" | "subtle"
valuenumberControlled value. null represents an empty field.
defaultValuenumberUncontrolled initial value.
onValueChange(value: number | null) => voidFires with the parsed value, or null when the field is cleared.
minnumberLower bound. Clamped on blur and at the stepper buttons.
maxnumberUpper bound. Clamped on blur and at the stepper buttons.
stepnumberStepper / ArrowUp-Down increment. Defaults to 1.
hideControlsbooleanHide the + / − buttons (keyboard + typing only).
decrementLabelstringAccessible label for the decrement button. Defaults to 'Decrease'.
incrementLabelstringAccessible label for the increment button. Defaults to 'Increase'.
labelreact.ReactNodeVisible field label, auto-associated to the input via htmlFor/id.
helperTextreact.ReactNodeHint shown below the field. Hidden while an error message is showing.
errorMessagereact.ReactNodeMessage shown below the field when error is true.
errorbooleanMarks the field invalid: sets aria-invalid and error styling.

Accessibility

The label, helper text, and error message are wired the same way as TextInput. The ArrowUp and ArrowDown keys change the value by step, and the stepper buttons carry accessible names.

Values are clamped rather than rejected, so users do not lose their input. Digits remain left to right inside Arabic layouts so the number reads correctly.