Number Field
A numeric input element with increment and decrement buttons, and a scrub area.
API reference
Import the component and assemble its parts:
import { NumberField } from '@base-ui-components/react/number-field';
<NumberField.Root>
  <NumberField.ScrubArea>
    <NumberField.ScrubAreaCursor />
  </NumberField.ScrubArea>
  <NumberField.Group>
    <NumberField.Decrement />
    <NumberField.Input />
    <NumberField.Increment />
  </NumberField.Group>
</NumberField.Root>Root
Groups all parts of the number field and manages its state.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
name | 
  | 
  | |
defaultValue | 
  | 
  | |
value | 
  | 
  | |
onValueChange | 
  | 
  | |
locale | 
  | 
  | |
step | 
  | 
  | |
smallStep | 
  | 
  | |
largeStep | 
  | 
  | |
min | 
  | 
  | |
max | 
  | 
  | |
allowWheelScrub | 
  | 
  | |
format | 
  | 
  | |
autoFocus | 
  | 
  | |
disabled | 
  | 
  | |
readOnly | 
  | 
  | |
required | 
  | 
  | |
invalid | 
  | 
  | |
id | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
ScrubArea
An interactive area where the user can click and drag to change the field value.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
direction | 
  | 
  | |
pixelSensitivity | 
  | 
  | |
teleportDistance | 
  | 
  | |
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
ScrubAreaCursor
A custom element to display instead of the native cursor while using the scrub area.
Renders a <span> element.
This component uses the Pointer Lock API, which may prompt the browser to display a related notification. It is disabled in Safari to avoid a layout shift that this notification causes there.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
Group
Groups the input with the increment and decrement buttons.
Renders a <div> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
Decrement
A stepper button that decreases the field value when clicked.
Renders an <button> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
Input
The native input control in the number field.
Renders an <input> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |
Increment
A stepper button that increases the field value when clicked.
Renders an <button> element.
| Prop | Type | Default | |
|---|---|---|---|
className | 
  | 
  | |
render | 
  | 
  | 
| Attribute | Description  | |
|---|---|---|
data-disabled | Present when the number field is disabled.  | |
data-readonly | Present when the number field is readonly.  | |
data-required | Present when the number field is required.  | |
data-valid | Present when the number field is in valid state (when wrapped in Field.Root).  | |
data-invalid | Present when the number field is in invalid state (when wrapped in Field.Root).  | |
data-dirty | Present when the number field's value has changed (when wrapped in Field.Root).  | |
data-touched | Present when the number field has been touched (when wrapped in Field.Root).  | |
data-filled | Present when the number field is filled (when wrapped in Field.Root).  | |
data-focused | Present when the number field is focused (when wrapped in Field.Root).  | |
data-scrubbing | Present while scrubbing.  | |