A numeric input with increment and decrement controls. Supports min, max, step, and controlled/uncontrolled modes.

import NumberField from "@radui/ui/NumberField"
Example
React
"use client" import NumberField from "@radui/ui/NumberField" const NumberFieldExample = () => { return ( <div className="flex flex-col gap-4"> <NumberField.Root defaultValue={5} step={1} min={0} max={100} largeStep={5}> <NumberField.Decrement aria-label="Decrease quantity">−</NumberField.Decrement> <NumberField.Input aria-label="Quantity" /> <NumberField.Increment aria-label="Increase quantity">+</NumberField.Increment> </NumberField.Root> </div> ) } export default NumberFieldExample
  • 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
ShortcutDescription
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.

ReferenceWhat 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.

React
import NumberField from "@radui/ui/NumberField" export default () => { return ( <NumberField.Root> <NumberField.Decrement /> <NumberField.Input /> <NumberField.Increment /> </NumberField.Root> ) }

The root NumberField component.

PropTypeDefault
value
number—
defaultValue
number | ''''
min
number—
max
number—
step
number1
largeStep
numberstep * 10
smallStep
numberstep / 10
name
string—
readOnly
booleanfalse
required
booleanfalse
disabled
booleanfalse
onValueChange
(value: number | '') => void—
format
Intl.NumberFormatOptions—
locale
stringbrowser locale
allowWheelScrub
booleanfalse
onValueCommit
(value: number | '') => void—
allowOutOfRange
booleanfalse
snapOnStep
booleanfalse
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.

PropTypeDefault
direction
'horizontal' | 'vertical''horizontal'
pixelSensitivity
number2
asChild
booleanfalse