Number Field
A numeric input element with increment and decrement buttons, and a scrub area.
API reference
Import the component and place its parts the following way:
Anatomy
import { NumberField } from '@base-ui-components/react/number-field';
<NumberField.Root>
<NumberField.Group>
<NumberField.Decrement />
<NumberField.Input />
<NumberField.Increment />
<NumberField.ScrubArea>
<NumberField.ScrubAreaCursor />
</NumberField.ScrubArea>
</NumberField.Group>
</NumberField.Root>
Root
The foundation for building custom-styled number fields.
Prop | Type | Default | |
---|---|---|---|
allowWheelScrub | boolean | false | |
autoFocus | boolean | false | |
className | string | (state) => string | undefined | |
defaultValue | number | undefined | |
disabled | boolean | false | |
format | Intl.NumberFormatOptions | undefined | |
id | string | undefined | |
invalid | boolean | false | |
largeStep | number | 10 | |
max | number | undefined | |
min | number | undefined | |
name | string | undefined | |
onValueChange | (value, event) => void | undefined | |
readOnly | boolean | false | |
render | | React.ReactElement | undefined | |
required | boolean | false | |
smallStep | number | 0.1 | |
step | number | undefined | |
value | number | undefined |
Group
Groups interactive NumberField
components together.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Decrement
The decrement stepper button.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Input
The input element for the number field.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Increment
The increment stepper button.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Scrub Area
The scrub area element.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
direction | 'horizontal' | 'vertical' | 'horizontal' | |
pixelSensitivity | number | 2 | |
render | | React.ReactElement | undefined | |
teleportDistance | number | undefined |
Scrub Area Cursor
The scrub area cursor element.
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |