Skip to content

Label

Form-control label rendered as a native <label>; supports required indicator and disabled colouring.

  • stable
  • since v0.1.0
  • 0.57 kB
  • forms

Renders a native <label>; pair with an input via htmlFor; required marker is aria-hidden.

Preview
Open
tsx

Set required to append a decorative red asterisk after the label text. The asterisk is aria-hidden; pair with required on the input for assistive tech.

Preview
Open
tsx

Set disabled to render the label in the disabled colour. Use this when the associated control is disabled.

Preview
Open
tsx

A Label, Input, and helper text laid out as a typical field.

Preview
Open
tsx
PropTypeDefaultDescription
required
boolean
Appends a red `*` after the label text. Purely decorative (`aria-hidden`).
disabled
boolean
Renders in the disabled colour.
className
string
style
CSSProperties
  • Renders a native <label> element; inherits all built-in semantics.
  • Use htmlFor to associate the label with its control by id.
  • Clicking the label transfers focus to the associated form field.
  • The required indicator is purely visual (aria-hidden); mirror the state on the input.
  • Pair every input, select, or textarea with a Label for screen-reader users.
  • Use a visually hidden label when the visual design omits a caption.
  • When using Fieldset for a group, prefer its legend over a free-standing Label.