Skip to main content

Label

The visible name of a form control.

In Multi-brand

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Multi-brand: Names every control.

  • Use it when: Every form control.
  • Not when: Never skipped: a placeholder is not a label.

Instead:

  • Field: The label laid out with hint and error.

How Multi-brand uses it​

Field label or column header
Use type.label
Not type.caption
Labels stay readable in every brand.

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Accessibility and keyboard​

Test before you ship:

  • The label is linked to its control and makes the hit area larger. undefined

Use it in code​

npx open-ds add label

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Label reads 6 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Label's tokens to change Label alone.

Changes with theme

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Label
Gapcomponent.label.gapspace.gap.defaultvar(--label-gap)space.12:0.75rem
Text
Changes with theme
component.label.labelcolor.text.primaryvar(--label-label)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Font family
Changes with theme
component.label.font-familytype.label.font-familyvar(--label-font-family)Aster Lightfont.family.inter:Inter, system-ui, sans-serifAster Darkfont.family.inter:Inter, system-ui, sans-serifBirch Lightfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifBirch Darkfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifCoral Lightfont.family.poppins:Poppins, system-ui, sans-serifCoral Darkfont.family.poppins:Poppins, system-ui, sans-serif
Text sizecomponent.label.font-sizetype.label.font-sizevar(--label-font-size)font.size.14:0.875rem
Weightcomponent.label.font-weighttype.label.font-weightvar(--label-font-weight)font.weight.600:600
Line heightcomponent.label.line-heighttype.label.line-heightvar(--label-line-height)font.line-height.1_2:1.2