Clinia UI

Label

Names a form control. A click on it focuses the control, and a screen reader reads it.

shadcn docs →

When to use

  • Name any form control: an input, a select, a checkbox, a switch.

When not to use

  • A label with a description and an error under it: use FieldLabel inside Field.
  • A title for a group of controls, such as a set of radio buttons: use FieldLegend inside FieldSet.
  • A heading for a section: use a heading element.

Install

npx shadcn@latest add @clinia/label

Clinia rules

  • Labels are 14px medium, sentence case, and name the value: Workspace name, not Please enter your workspace name:. No trailing colon.
  • When its control is disabled, the label fades to 50% with it: put the control first as a peer, or both in a group with data-disabled="true".

Do and don't

Do name the value in a few words.
Don't write the label as an instruction.

States

default
beside a disabled control

Toggle the site theme to review both themes.

Accessibility

Your responsibility

  • Set htmlFor to the control's id, or wrap the control in the label. A label that points nowhere names nothing.
  • Keep the label visible. A placeholder is not a label: it disappears as soon as the user types.

How to test

  1. Click the label: focus moves to its control, and a checkbox or switch toggles.
  2. With a screen reader, Tab to the control: it's announced with the label's text.

API

Every prop comes from the native label element.