NumberInput

A number input with built-in stepper buttons, min / max / step and decimal precision handling, arrow-key stepping, and native form submission.

Props

PropTypeDefaultDescription
valuenumber | null—Controlled value, null for empty; omit to run uncontrolled
defaultValuenumber | nullnullInitial value when uncontrolled, default null
onValueChange(value: number | null) => void—Called on change; null when cleared with allowEmpty
minnumber—Minimum value
maxnumber—Maximum value
stepnumber1Step for keyboard and buttons, default 1
allowEmptybooleanfalseAllow clearing to null, default false (blur falls back to the last valid value)
size'sm' | 'md' | 'lg''md'Size: sm / md / lg
invalidboolean—Invalid state: red outline plus aria-invalid
prefixReactNode—Content rendered before the input
suffixReactNode—Content rendered between the value and the steppers
namestring—Form field name, submitted with a native form
...restInputHTMLAttributes—Remaining props are forwarded to the native input