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.
Keyboard Shortcuts
Navigate forms using keyboard.
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