Label
The visible name of a form control.
In Content first
See it live
npm run storybookWhen to use it
In Content first: Names every field.
- 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 Content first uses it
Words
- Write to one person: "you", not "users".
- Short sentences with room to breathe.
- Explain why before asking for anything.
- Use: Read, Save for later, You, Next issue. Avoid: Click here, Submit, Users, Content.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Browse guides
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.
Content first decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Label | ||
| Gap | component.label.gapspace.gap.defaultvar(--label-gap) | space.16:1rem |
| Text Changes with theme | component.label.labelcolor.text.primaryvar(--label-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Font family | component.label.font-familytype.label.font-familyvar(--label-font-family) | font.family.inter:Inter, system-ui, sans-serif |
| Text size | component.label.font-sizetype.label.font-sizevar(--label-font-size) | font.size.16:1rem |
| Weight | component.label.font-weighttype.label.font-weightvar(--label-font-weight) | font.weight.600:600 |
| Line height | component.label.line-heighttype.label.line-heightvar(--label-line-height) | font.line-height.1_45:1.45 |