Label
Accessible name for a form control. Title-cases value unless you opt out.
Default
value is the visible text. The control association is html-for, matching the native for attribute.
1
<Label value="This is a label" />
With input
with-input adds space under the label. Point html-for at the field id.
Bypass casing
value is Title Cased by default («email address» → «Email Address»). bypass-casing keeps the string you pass.
Slot
Default slot replaces value when you need markup inside the label.
On Input
Input already mounts Label when you pass label. Use this component when the label sits elsewhere or needs extra markup.
1
<Input label="Project Name" placeholder="my-awesome-project" />
Best practices
- Every text field, select, and checkbox needs a visible Label. Placeholder is not a name.
- Wire
html-forto the controlid. A matchingidon the Label itself is only foraria-labelledby. - Keep copy to a short Title Case noun: Project Name, Domain, Environment Variable. Helper sentences live next to the field, not in the label.
- Use
bypass-casingfor product names, env keys, and any string that is not English title case. - Prefer
Input'slabelprop for a stacked field. Use Label directly when the caption is shared, sits beside the control, or contains extra markup.