Overview
<label> element with A’raf DS typography tokens. It automatically associates with its input via htmlFor, and supports required indicators (*) and disabled styling.
Installation
Usage
Variants
Default
Required
Disabled
With Checkbox
API Reference
The
id of the associated input element. Required for accessibility.Appends a red asterisk
* after the label text.Applies muted styling (
#9CA3AF text, not-allowed cursor).Additional class names.
Accessibility
- Label renders as a native
<label>element — never as a<span>or<div> htmlFormust match theidof the associated input to create a programmatic link- When
requiredis set, the*indicator is visually shown and the linked input should also have the HTMLrequiredattribute - Clicking the label moves focus to the associated input — this is native browser behavior and must not be overridden
- When using Label with
CheckboxorSwitch, wrap both in a<label>or usehtmlFor+id— never rely on proximity alone
Do’s & Don’ts
Do
- Always provide a Label for every form control
- Match
htmlForto the input’sidexactly - Mark required fields with both the
requiredprop and HTMLrequiredattribute - Use Label’s
disabledprop to visually match the state of a disabled input
Don't
- Don’t use placeholder text as a substitute for a visible Label
- Don’t use a
<span>or<div>for labels — use this component - Don’t omit
htmlFor— screen readers won’t associate the label with the input - Don’t put long instructions in a Label — use
FormDescriptionfor that