A numeric input with increment and decrement controls. Supports min, max, step, and controlled/uncontrolled modes.
import NumberField from "@radui/ui/NumberField"- Increment and decrement buttons; largeStep and smallStep for coarser and finer steps
- Parses and formats with Intl.NumberFormat for the given locale
- min, max and step clamp and snap the value; allowOutOfRange turns clamping off
- A scrub area changes the value by dragging; allowWheelScrub does it with the wheel
- Submits the parsed number under name; works inside Field.Root
| 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; Alt/Option plus ArrowUp uses smallStep. |
| ArrowDown | Decrements the current value by step when focus is on the input. Shift plus ArrowDown uses largeStep; Alt/Option plus ArrowDown uses smallStep. |
| 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 |
|---|---|
| Spinbutton pattern | 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 |
smallStep | number | step / 10 |
name | string | — |
readOnly | boolean | false |
required | boolean | false |
disabled | boolean | false |
onValueChange | (value: number | '') => void | — |
format | Intl.NumberFormatOptions | — |
locale | string | browser locale |
allowWheelScrub | boolean | false |
onValueCommit | (value: number | '') => void | — |
allowOutOfRange | boolean | false |
snapOnStep | boolean | false |
form | string | — |
inputRef | Ref<HTMLInputElement> | — |
Drag over it, often a short label, to change the value like the inputs in design tools. Moving right or up increments; Shift uses largeStep. Carries data-scrubbing while dragging.
| Prop | Type | Default |
|---|---|---|
direction | 'horizontal' | 'vertical' | 'horizontal' |
pixelSensitivity | number | 2 |
asChild | boolean | false |