Component
A numeric input with increment and decrement controls. Supports min, max, step, and controlled/uncontrolled modes.
View component changelog| Shortcut | Description |
|---|---|
Tab | Moves focus to the number input. Increment and decrement buttons are pointer controls and stay out of the tab order. |
ArrowUp | Increments the current value by step when focus is on the input. Shift plus ArrowUp uses largeStep. |
ArrowDown | Decrements the current value by step when focus is on the input. Shift plus ArrowDown uses largeStep. |
PageUp | Increments the current value by largeStep. |
PageDown | Decrements the current value by largeStep. |
Home | Sets the value to min when min is defined. |
End | Sets the value to max when max is defined. |
| Reference | What Rad UI follows |
|---|---|
Uses the native number input spinbutton behavior. name, required, disabled, and readOnly are forwarded to the input, while min, max, and step are forwarded as native constraints. Stepped values are clamped immediately; typed values are clamped on blur or Enter. |
Import all parts of the component and piece them together
The root NumberField component.
| Prop | Type | Default |
|---|---|---|
value | number | -- |
defaultValue | number | '' | '' |
min | number | -- |
max | number | -- |
step | number | 1 |
largeStep | number | step * 10 |
name | string | -- |
readOnly | boolean | false |
required | boolean | false |
disabled | boolean | false |
onValueChange | (value: number | '') => void | -- |