Component
Label renders a native label that names a form control. Use it with htmlFor, or wrap the control, so screen readers announce the control's name and clicking the label focuses it.
View component changelogpreview
- Native <label>, so clicking it focuses or toggles the control it names
- Name a control with htmlFor, or by wrapping the control
- Double-clicking the label doesn't select its text; nested controls still get their own clicks
- asChild to render your own element with the label's props
- Unstyled by default, with Clarity and baremetal styles available
Renders a native <label> that names a form control, either through htmlFor or by wrapping the control.
| Prop | Type | Default |
|---|---|---|
htmlFor | string | -- |
asChild | boolean | false |
customRootClass | string | '' |
className | string | '' |