Number input

A number, formatted and parsed against a locale you declare. Guessing the locale from the string is how 1,5 becomes fifteen on a money field, silently.

Reach for it

A quantity, with the stepper and the locale formatting handled.

Not for

A reference or an identifier that only looks numeric.

One number, two locales

Grouped at rest, plain while editing, and reformatted on blur, so the value is readable when it is being read and editable when it is being edited. The locale is required rather than defaulted, because a wrong default prints a wrong number and nobody reports it.

Grouped at rest, plain while editing

Same number, other separators

Committed value: 1234.5

Negatives allowed, whole euros only

API reference

NumberInput

PropTypeDefaultDescription
locale*string-Required, not defaulted. A number's separators are text the user reads, and a default of 'en-US' prints a French invoice total as 1,234.5. Guessing wrong here is worse than asking.
size'small' | 'medium' | 'large'medium
hasStartAdornmentbooleanfalseRoom for a marker or a button inside the control's own padding box. The padding belongs to the control, so it lives here. The marker's own geometry belongs to the marker, so it lives in adornment.ts. Four components each carried the whole table before, and the one in combobox.tsx said "mirroring SearchInput" in a comment, which is the note a copy leaves behind.
hasEndAdornment'true' | 'false' | 'double'false`double` is two markers at the end, a clear button beside a calendar button. Twice the room, so the value never runs under either of them.
valuenumber | null-
defaultValuenumber | null-
onValueChange(value: number | null) => void-
maxFractionDigitsnumber-
isNegativeAllowedboolean-

Also takes the standard attributes of a input, minus className, style, size, type, value, defaultValue, onChange and inputMode.