Field Label
A field label associates visible copy with a form control. Use catnip-field-label when Catnip does not own the control — for example a native <select>, a third-party widget, or a custom layout — and you want the same label row as Input, Date Input, Number Input, Phone Input, and Chip Input.
Overview
catnip-field-label renders a native <label> with optional required marker, optional hint, info tooltip, and trailing action / suffix slots.
When to use
- Custom controls — pair with any element that accepts an
idand can be referenced fromhtml-for. - Composite inputs — prefer
label/labelslot props oncatnip-input,catnip-input-date,catnip-input-number,catnip-input-phone, andcatnip-input-chipwhen Catnip owns the field; those components embed the same label primitive and wirefor/idfor you.
Layout
- Default spacing — the root includes bottom margin (label→control gap) unless
flushis set. - Alignment —
left(default),center, orrightfor the label block. - Size —
s,m, orltypography matching field sizes.
Live example
Accessibility
- Set
html-foron the label and a matchingidon the associated control. - When
requiredis true, setrequiredand/oraria-required="true"on the control — the label marker is visual only. - When
disabledis set on the label for visual coordination, also set nativedisabledon the control. - Optional
required-screen-reader-textadds a supplemental hidden phrase only when non-empty; it does not replacearia-requiredon the control.
See Guidelines for slot patterns and Specs for the full prop reference.