Overview
Label provides an accessible label that can be associated with form controls. It automatically handles the association when wrapping a control or using thehtmlFor prop.
Features
- Supports nested controls
- Supports custom controls
- Accessible text for screen readers
- Works with all form inputs
Installation
Anatomy
API Reference
Root
The label component.string
The id of the element the label is associated with.
boolean
default:"false"
Change the default rendered element for the one passed as a child.
Example
Accessibility
This component is based on the native
label element and follows the same accessibility guidelines. It will automatically trigger the associated control when clicked.Features
- Clicking the label focuses or activates the associated control
- Screen readers announce the label when the control is focused
- Supports both explicit (
htmlFor) and implicit (wrapping) associations