Overslaan naar hoofdinhoud

Typografie

Openen in ChatGPT

Typografie tokens worden gebruikt om een consistente set van letterstijlletjes door je app heen te handhaven.

Lettertype familie​

De lettertype familie eigenschappen worden gebruikt om een prioriteitenlijst van lettertypen te specificeren.

De systeemlettertype stapel wordt standaard gebruikt via system-ui, wat automatisch wordt opgelost naar het native lettertype van het platform:

  • San Francisco op macOS en iOS
  • Segoe UI op Windows
  • Roboto op Android en Chrome OS

Je kunt de lettertype familie toepassen of wijzigen met behulp van de aangepaste eigenschap --dwc-font-family.

Voorbeeld​

:root {
--dwc-font-family: "Roboto", sans-serif;
}

Variabelen​

VariabeleStandaardwaarde
--dwc-font-family-sanssystem-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
--dwc-font-family-monoui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace
--dwc-font-familyvar(--dwc-font-family-sans)

Lettergrootte​

De lettergrootte eigenschappen definiëren een set lettergroottes om uit te kiezen. m is de standaardgrootte en wordt door de meeste componenten standaard gebruikt. Alle lettergroottes zijn gedefinieerd in rem.

REM Eenheid

rem is een relatieve lengte-eenheid. Het is relatief aan de lettergrootte van het rootelement (<html>), wat in de meeste browsers standaard op 16px staat.

Voorbeeld​

.title {
font-size: var(--dwc-font-size-3xl);
}

Variabelen​

VariabeleStandaardwaardeBerekenend (bij 16px root)
--dwc-font-size-3xs0.625rem10px
--dwc-font-size-2xs0.6875rem11px
--dwc-font-size-xs0.75rem12px
--dwc-font-size-s0.8125rem13px
--dwc-font-size-m0.875rem14px
--dwc-font-size-l1rem16px
--dwc-font-size-xl1.25rem20px
--dwc-font-size-2xl1.625rem26px
--dwc-font-size-3xl2.125rem34px
--dwc-font-sizevar(--dwc-font-size-m)14px

Lettergewicht​

De font-weight CSS eigenschap stelt het gewicht (of vetheid) van het lettertype in.

Voorbeeld​

p {
font-weight: var(--dwc-font-weight-semibold);
}
VariabeleStandaardwaarde
--dwc-font-weight-thin100
--dwc-font-weight-lighter200
--dwc-font-weight-light300
--dwc-font-weight-normal400
--dwc-font-weight-medium500
--dwc-font-weight-semibold600
--dwc-font-weight-bold700
--dwc-font-weight-bolder800
--dwc-font-weight-black900
--dwc-font-weightvar(--dwc-font-weight-normal)

Regelhoogte​

De lijnhoogte CSS eigenschap stelt de hoogte van een lijnbox in. Het wordt vaak gebruikt om de afstand tussen regels tekst in te stellen.

Voorbeeld​

p {
line-height: var(--dwc-font-line-height-m);
}

Variabelen​

VariabeleStandaardwaarde
--dwc-font-line-height-3xs1
--dwc-font-line-height-2xs1.1
--dwc-font-line-height-xs1.25
--dwc-font-line-height-s1.375
--dwc-font-line-height-m1.5
--dwc-font-line-height-l1.625
--dwc-font-line-height-xl1.75
--dwc-font-line-height-2xl1.875
--dwc-font-line-height-3xl2
--dwc-font-line-heightvar(--dwc-font-line-height-xs)