For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt, and this page is available as Markdown at https://wallarm.github.io/design-system/components/number-input.md.

NumberInput

A number the reader nudges rather than types from scratch โ€” reach for Input when the figure is just data like a port or an ID, and Slider when the position matters more than the exact value. It starts at zero rather than empty, so pass defaultValue wherever a pre-filled zero would be mistaken for an answer.

Source ยท Storybook

Usage

import { NumberInput } from '@wallarm-org/design-system/NumberInput';

Examples

Sizes

The same height scale as Input, with the steppers shrinking to match rather than being dropped at the smaller sizes.

Disabled

Field and steppers both out. Worth checking here that the value still reads clearly, since a number nobody can change is often the number that matters.

With value

A set value. Typing is allowed as well as stepping, and the value is clamped against min and max rather than refused as it is typed.

With error

error reddens the border and sets the invalid state; the reason belongs in FieldError beneath it.

Props

PropTypeDefaultDescription
formstring | undefinedThe associate form of the input element.
titlestring | undefined
patternstring | undefinedThe pattern used to check the <input> element's value against
defaultCheckedboolean | undefined
defaultValuestring | undefined0The initial value of the input when rendered. Use when you don't need to control the value of the input.
autoFocusboolean | undefined
idstringThe unique identifier of the machine.
tabIndexnumber | undefined
relstring | undefined
inputModeInputMode | undefinedHints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices
onChangeChangeEventHandler<T, Element> | undefined
disabledboolean | undefinedWhether the number input is disabled.
namestring | undefinedThe name attribute of the number input. Useful for form submission.
valuestring | undefinedThe controlled value of the input
asChildboolean | undefinedUse the provided child element as the default rendered element, combining their props and behavior.
idsElementIds | undefinedThe ids of the elements in the number input. Useful for composition.
readOnlyboolean | undefinedWhether the number input is readonly
requiredboolean | undefinedWhether the number input is required
onValueChangecomplexFunction invoked when the value changes
stepnumber | undefinedThe amount to increment or decrement the value by
maxnumber | undefinedThe maximum value of the number input
minnumber | undefinedThe minimum value of the number input
translationsIntlTranslations | undefinedSpecifies the localized strings that identifies the accessibility elements and their states
largeStepnumber | undefinedThe amount to increment or decrement the value by when the Shift key is held.
smallStepnumber | undefinedThe amount to increment or decrement the value by when the Alt key is held.
allowMouseWheelboolean | undefinedWhether to allow mouse wheel to change the value
allowOverflowboolean | undefinedWhether to allow the value overflow the min/max range
clampValueOnBlurboolean | undefinedWhether to clamp the value when the input loses focus (blur)
focusInputOnChangeboolean | undefinedWhether to focus input when the value changes
formatOptionsIntl.NumberFormatOptions | undefinedThe options to pass to the Intl.NumberFormat constructor
onValueInvalidcomplexFunction invoked when the value overflows or underflows the min/max range
onFocusChangecomplexFunction invoked when the number input is focused
onValueCommitcomplexFunction invoked when the value is committed (when the input is blurred or the Enter key is pressed)
spinOnPressboolean | undefinedWhether to spin the value when the increment/decrement button is pressed
localestring | undefinedThe current locale. Based on the BCP 47 definition.
size{ default: string; medium: string; small: string; 'inline-edit': string; }default
errorboolean | undefinedfalse
data-testidstring | undefined