Field

A component that provides labelling and validation for form controls.

Visible on your profile

API reference

Import the component and place its parts the following way:

Anatomy
import { Field } from '@base-ui-components/react/field';

<Field.Root>
  <Field.Control />
  <Field.Label />
  <Field.Description />
  <Field.Error />
  <Field.Validity />
</Field.Root>

Root

The foundation for building custom-styled fields.

PropTypeDefault
classNamestring | (state) => stringundefined
disabledbooleanfalse
invalidbooleanundefined
namestringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
validate| (value) => string
| string[]
| null
| Promise
undefined
validationDebounceTimenumber0
validationMode'onBlur' | 'onChange''onBlur'

Label

A label for the field's control.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Description

A description message for the field's control.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Error

Displays error messages for the field's control.

PropTypeDefault
classNamestring | (state) => stringundefined
forceShowbooleanundefined
match| 'badInput'
| 'customError'
| 'patternMismatch'
| 'rangeOverflow'
| 'rangeUnderflow'
| 'stepMismatch'
| 'tooLong'
| 'tooShort'
| 'typeMismatch'
| 'valid'
| 'valueMissing'
undefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Control

The field's control element. This is not necessary to use when using a native Base UI input component (Checkbox, Switch, NumberField, Slider, Radio Group etc).

PropTypeDefault
classNamestring | (state) => stringundefined
onValueChange(value, event) => voidundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Validity

Render prop component that provides the field's validity state and value to its children.

PropTypeDefault
children(validity) => React.ReactNodeundefined