Label
1 partsA caption associated with a form control. Renders a native <label> and,
when for matches a control's id, lets clicks focus or toggle that control
while announcing the text to assistive technology. Double-click text
selection is suppressed so labels stay clickable. Use it to label inputs,
checkboxes, switches, and other custom controls.
Demo
Anatomy
Import the parts and compose them. Each part forwards attributes to its underlying element.
import {
Label,
} from '@robonen/primitives/forms/label';
<Label />API Reference
Label
RootA caption associated with a form control. Renders a native `<label>` and, when `for` matches a control's id, lets clicks focus or toggle that control while announcing the text to assistive technology. Double-click text selection is suppressed so labels stay clickable. Use it to label inputs, checkboxes, switches, and other custom controls.
| Prop | Type | Description |
|---|---|---|
for? | string | The id of the element the label is associated with (renders as for). |