Components
Label
An accessible caption for a form control, built on Radix Label — pair it with an input, checkbox, or switch to give the field a clickable, screen-reader-friendly name.
Basic usage
Connect the label to a field with htmlFor matching the control's id.
With controls
Wrap a Checkbox or Switch inside the label so the whole row becomes the click target.
Disabled field
When the associated control is disabled, the label automatically dims via the peer-disabled styles.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
htmlFor | string | — | ID of the form control this label describes. Clicking the label focuses or toggles that control. |
children | React.ReactNode | — | Label text and any inline controls (e.g. a Checkbox or Switch) rendered alongside it. |
className | string | — | Additional Tailwind classes to merge onto the root element. |
...rest | LabelHTMLAttributes | — | All native label attributes are forwarded to the underlying element. |
Accessibility
- Renders a native
<label>; anhtmlForthat matches the control'sidwires up the programmatic name for assistive technology. - Clicking the label moves focus to — or toggles — the associated input, checkbox, or switch, enlarging the hit target for pointer and touch users.
- The component blocks text selection on double-click (
select-none) so rapid clicks toggle the control instead of highlighting the caption. - When the paired control is disabled, the label inherits a reduced-opacity,
cursor-not-allowedstate so the field reads as unavailable.