Skip to content

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 label row: a native <label> with the title, optional hint and required marker, followed by an optional info button and the action / suffix slots. Those sit beside the <label>, so they aren't part of the field's name.

When to use ​

  • Custom controls — pair with any element that accepts an id and aria-labelledby and can be referenced from html-for.
  • Composite inputs — prefer label / label slot props on catnip-input, catnip-input-date, catnip-input-number, catnip-input-phone, and catnip-input-chip when Catnip owns the field; those components embed the same label primitive and wire for / id for you.

Layout ​

  • Default spacing — the root includes bottom margin (label→control gap) unless flush is set.
  • Alignment — left (default), center, or right for the label block.
  • Size — m or l typography. Small composite fields use the medium label treatment.

Live example ​

Guidelines ​

When to use standalone vs composite inputs ​

  • Use catnip-field-label when the control is not a Catnip input — native elements, third-party widgets, file uploads, grouped custom layouts.
  • Use composite label props on catnip-input, catnip-input-date, catnip-input-number, catnip-input-phone, and catnip-input-chip when Catnip owns the field. Those components embed the same label and wire html-for / id automatically.

Wiring ​

html
<catnip-field-label html-for="country" required>
  Country
</catnip-field-label>
<select id="country" required aria-required="true">…</select>
  • html-for on the label must match the control id. The label sits in a shadow root, so it names the control by adding its own id to the control's aria-labelledby, and forwards clicks to it. See Accessibility.
  • Catnip fields work the same way: <catnip-field-label html-for="email"> names <catnip-input id="email"> when the input has no label of its own.
  • required on the label is visual only — set required and/or aria-required="true" on the control.
  • disabled on the label coordinates appearance only — set native disabled on the control.

Slots ​

  • action — end-aligned link or button (e.g. “Don’t know address?”). Project with slot="action" on a child such as catnip-link.
  • suffix — custom trailing content when you are not using the info prop. When info is non-empty, it wins and suffix is omitted.

Composite inputs use label.action and label.suffix for the same patterns.

Info tooltip ​

Pass a plain string to info to render an info button beside the title. It's named “More information about {title}” and described by the text, which shows as a tooltip on hover and focus. For a custom anchor or tooltip body, leave info empty and use the suffix slot with catnip-tooltip; give your anchor a name and connect its description (see Tooltip accessibility).

Spacing ​

  • Default — label includes bottom margin to the control.
  • flush — use when a parent wrapper already defines vertical rhythm (flex gap, stacked fields).

Helper / error copy ​

Standalone labels do not include supporting text. For Catnip-owned fields, use supporting-text on catnip-input, catnip-input-date, catnip-input-number, catnip-input-phone, or catnip-input-chip. For custom controls, use your own helper markup below the field until a public supporting-text primitive is available.

Catnip Design System by Signicat