Skip to contents

Label

An accessible label component for Base UI form controls.

View as Markdown

Usage guidelines

  • Use when standalone: Label is a lightweight version of Field.Label that does not include Field validation state attributes. Use Field.Label when the control is wrapped in Field.Root.
  • Use non-native labeling for trigger controls: For controls like <Select.Trigger> and <Combobox.Trigger>, set nativeLabel={false} and render={<div />} so clicks focus the trigger without inheriting native <label> behavior.

Anatomy

Import the component and use it as a single part:

Anatomy

Labeling patterns

For <Checkbox.Root>, <Switch.Root>, and <Radio.Root>, prefer wrapping the control with Label instead of using a sibling label. Wrapping avoids tracking IDs manually and keeps CSS gaps between the control and text clickable.

Recommended wrapping pattern

Sibling htmlFor/id labeling is supported as a fallback. For non-nativeButton controls, aria-labelledby is attached after hydration. If you need sibling labeling behavior during SSR, use nativeButton with render={<button />} on the control.

SSR-first sibling fallback pattern

Label also prevents accidental text selection from double clicks on the label.

Examples

Labeling a checkbox

Using Label with Checkbox

Labeling a select trigger

Using Label with Select.Trigger

API reference

nativeLabelbooleantrue
Description

Whether the component renders a native <label> element when replacing it via the render prop. Set to false if the rendered element is not a label (e.g. <div>).

This is useful to avoid inheriting label behaviors on <button> controls (such as <Select.Trigger> and <Combobox.Trigger>), including avoiding :hover on the button when hovering the label, and preventing clicks on the label from firing on the button.

Type
boolean | undefined
Default
true
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
| string
| ((state: Label.State) => string | undefined)
styleReact.CSSProperties | function
Name
Type
| React.CSSProperties
| ((state: Label.State) => CSSProperties | undefined)
| undefined
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
| ReactElement
| ((props: HTMLProps, state: Label.State) => ReactElement)