Skip to content

Field Label

Props

PropTypeDefaultOptionsDescription
htmlForstring""Associates the label with a control (for attribute). HTML attribute: html-for.
idstring""Optional id on the root <label>.
alignmentstring"left"left, center, rightHorizontal alignment of the label block.
sizestring"m"s, m, lLabel typography: s / m → text-m medium; l → text-l medium.
requiredbooleanfalsetrue, falseShows the visual required marker. Pair with required on the control.
requiredScreenReaderTextstring""Optional screen-reader-only supplement when non-empty. HTML attribute: required-screen-reader-text.
requiredMarkerstring"*"Visual marker when required. HTML attribute: required-marker.
optionalbooleanfalsetrue, falseWhen true and not required, shows the optional hint.
optionalTextstring""Overrides the default optional hint (locale("fieldLabel.optional")). HTML attribute: optional-text.
disabledbooleanfalsetrue, falseMutes the label visually when the control is disabled.
flushbooleanfalsetrue, falseRemoves default bottom margin so the parent supplies vertical spacing.
infostring""When non-empty, renders a trailing catnip-tooltip. Wins over the suffix slot.
testSelectorsobjectSee Test SelectorsOverride data-test attributes for testing.

See Component API — Props.

Slots

NameDescription
(default)Visible label title text.
actionEnd-aligned action on the label row (e.g. catnip-link).
suffixTrailing content beside the title (e.g. custom tooltip anchor). Omitted when info is non-empty.

On composite inputs (catnip-input, etc.), the same patterns use prefixed slot names: label, label.action, label.suffix.

See Component API — Slots.

Events

This component has no events.

See Component API — Events.

Test Selectors

AttributeDefault Value
rootcatnip-field-label
maincatnip-field-label-main
optionalcatnip-field-label-optional
requiredcatnip-field-label-required
suffixcatnip-field-label-suffix
actioncatnip-field-label-action

See Component API — Test selectors.

Catnip Design System by Signicat