Skip to content
+

Number Field

Number Field provides users with a numeric input, with buttons and a scrub area to increment or decrement its value.

NumberFieldDecrement API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldDecrement = NumberField.Decrement;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldDecrement to change the default props of this component with the theme.

NumberFieldGroup API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldGroup = NumberField.Group;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldGroup to change the default props of this component with the theme.

NumberFieldIncrement API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldIncrement = NumberField.Increment;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldIncrement to change the default props of this component with the theme.

NumberFieldInput API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldInput = NumberField.Input;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldInput to change the default props of this component with the theme.

NumberFieldRoot API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldRoot = NumberField.Root;

Props

Props of the native component are also available.

NameTypeDefaultDescription
allowWheelScrubboolfalse

Whether to allow the user to scrub the input value with the mouse wheel while focused and hovering over the input.

autoFocusboolfalse

If true, the input element is focused on mount.

classNamefunc
| string
-

Class names applied to the element or a function that returns them based on the component's state.

defaultValuenumber-

The default value of the input element. Use when the component is not controlled.

disabledboolfalse

If true, the input element is disabled.

format{ compactDisplay?: 'long'
| 'short', currency?: string, currencyDisplay?: string, currencySign?: string, localeMatcher?: string, maximumFractionDigits?: number, maximumSignificantDigits?: number, minimumFractionDigits?: number, minimumIntegerDigits?: number, minimumSignificantDigits?: number, notation?: 'compact'
| 'engineering'
| 'scientific'
| 'standard', signDisplay?: 'always'
| 'auto'
| 'exceptZero'
| 'never', style?: string, unit?: string, unitDisplay?: 'long'
| 'narrow'
| 'short', useGrouping?: bool }
-

Options to format the input value.

idstring-

The id of the input element.

invalidboolfalse

If true, the input element is invalid.

largeStepnumber10

The large step value of the input element when incrementing while the shift key is held. Snaps to multiples of this value.

maxnumber-

The maximum value of the input element.

minnumber-

The minimum value of the input element.

namestring-

The name of the input element.

onValueChangefunc-

Callback fired when the number value changes.

Signature:function(value: number | null, event: Event) => void
  • value The new value.
  • event The event that triggered the change.
readOnlyboolfalse

If true, the input element is read only.

renderelement
| func
-

A function to customize rendering of the component.

requiredboolfalse

If true, the input element is required.

smallStepnumber0.1

The small step value of the input element when incrementing while the meta key is held. Snaps to multiples of this value.

stepnumber-

The step value of the input element when incrementing, decrementing, or scrubbing. It will snap to multiples of this value. When unspecified, decimal values are allowed, but the stepper buttons will increment or decrement by 1.

valuenumber-

The raw number value of the input element.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldRoot to change the default props of this component with the theme.

NumberFieldScrubArea API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldScrubArea = NumberField.ScrubArea;

Props

Props of the native component are also available.

NameTypeDefaultDescription
classNamefunc
| string
-

Class names applied to the element or a function that returns them based on the component's state.

direction'horizontal'
| 'vertical'
'vertical'

The direction that the scrub area should change the value.

pixelSensitivitynumber2

Determines the number of pixels the cursor must move before the value changes. A higher value will make the scrubbing less sensitive.

renderelement
| func
-

A function to customize rendering of the component.

teleportDistancenumber-

If specified, how much the cursor can move around the center of the scrub area element before it will loop back around.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldScrubArea to change the default props of this component with the theme.

NumberFieldScrubAreaCursor API

Import

import * as NumberField from '@base_ui/react/NumberField';
const NumberFieldScrubAreaCursor = NumberField.ScrubAreaCursor;

Props

Props of the native component are also available.

NameTypeDescription
classNamefunc
| string

Class names applied to the element or a function that returns them based on the component's state.

renderelement
| func

A function to customize rendering of the component.


The ref is forwarded to the root element.

Theme default props

You can use NumberFieldScrubAreaCursor to change the default props of this component with the theme.