Skip to content
+

Field

Fields represent an individual section of a form containing an associated control and label, as well as any description or validation messages.

FieldControl API

Import

import * as Field from '@base_ui/react/Field';
const FieldControl = Field.Control;

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 FieldControl to change the default props of this component with the theme.

FieldDescription API

Import

import * as Field from '@base_ui/react/Field';
const FieldDescription = Field.Description;

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 FieldDescription to change the default props of this component with the theme.

FieldError API

Import

import * as Field from '@base_ui/react/Field';
const FieldError = Field.Error;

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.

forceShowbool

Determines whether the error message should be shown regardless of the field's client validity.

renderelement
| func

A function to customize rendering of the component.

show'badInput'
| 'customError'
| 'patternMismatch'
| 'rangeOverflow'
| 'rangeUnderflow'
| 'stepMismatch'
| 'tooLong'
| 'tooShort'
| 'typeMismatch'
| 'valid'
| 'valueMissing'

Determines whether the error message should be shown when it matches a given property of the field's ValidityState.


The ref is forwarded to the root element.

Theme default props

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

FieldLabel API

Import

import * as Field from '@base_ui/react/Field';
const FieldLabel = Field.Label;

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 FieldLabel to change the default props of this component with the theme.

FieldRoot API

Import

import * as Field from '@base_ui/react/Field';
const FieldRoot = Field.Root;

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.

invalidbool-

Determines if the field is forcefully marked as invalid.

renderelement
| func
-

A function to customize rendering of the component.

validatefunc-

Function to custom-validate the field's value. Return a string or array of strings with error messages if the value is invalid, or null if the value is valid. The function can also return a promise that resolves to a string, array of strings, or null.

validateDebounceTimenumber0

The debounce time in milliseconds for the validate function in the change phase.

validateOnChangeboolfalse

Determines if validation should be triggered on the change event, rather than only on commit (blur).


The ref is forwarded to the root element.

Theme default props

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

FieldValidity API

Import

import * as Field from '@base_ui/react/Field';
const FieldValidity = Field.Validity;

Props

Props of the native component are also available.

NameTypeDescription

The component cannot hold a ref.