Skip to main content

Installation

Or use the CLI:
For form fields, use the Field component which includes built-in label, description, and error handling.

Usage

Component API

Label

An accessible label component built on Radix UI. Props:
  • htmlFor - Associates label with form control
  • className - Additional CSS classes
  • All standard HTML label attributes

Examples

Basic

A simple label with an input:

With Description

Combine label with a description:

Required

Indicate required fields:

With Checkbox

Use with checkboxes:

With Radio

Use with radio buttons:

With Switch

Use with switches:

Disabled State

Label for disabled inputs:

Error State

Label for inputs with errors:

Form Field

For complex forms, use the Field component:

With Icons

Combine labels with icons:

Accessibility

  • Built on Radix UI Label for accessibility
  • Proper label association with form controls
  • Click label to focus input
  • Screen reader compatible
  • ARIA attributes automatically applied

API Reference

See the Base UI Label documentation for complete API details.