Label Primitive

Headless, unstyled label primitive with full accessibility support.

Basic Headless Primitive

The primitive provides semantic HTML label element without styling.

Click the label to focus the input field.

With Form Elements

Labels work with all form input types.

Required Fields

Common pattern for showing required fields.

Accessibility Features

Built-in accessibility features following WAI-ARIA design patterns.

Semantic HTML: Uses native <label> element for proper semantics
Form association: for attribute automatically links label to input
Click target: Clicking label focuses associated input
Screen reader support: Screen readers announce label text when input is focused
No JavaScript required: All functionality is native browser behavior

Keyboard Shortcuts

Navigate forms using keyboard.

Navigate between inputs Tab
Click label to focus input Click

API Reference

Component properties and parameters.

Label

For

Type: string?
The ID of the form element this label is associated with. Maps to the HTML for attribute.

ChildContent

Type: RenderFragment?
The content to be rendered inside the label element (label text).

Additional Attributes

Any additional attributes (class, style, etc.) are passed to the label element.

When to Use Primitives

Choose between primitives and styled components based on your needs.

Use Label Primitive

  • Building a custom design system
  • Need complete control over styling
  • Want to apply your own CSS framework
  • Creating unique visual designs

Use Styled Component

  • Want shadcn/ui design out of the box
  • Need quick implementation
  • Like the default styling
  • Prefer convention over configuration
An unhandled error has occurred. Reload 🗙