Label

1 parts

A 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

Loading demo…

Anatomy

Import the parts and compose them. Each part forwards attributes to its underlying element.

vue
import {
  Label,
} from '@robonen/primitives/forms/label';

<Label />

API Reference

Label

Root

A 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.

PropTypeDescription
for?stringThe id of the element the label is associated with (renders as for).