Skip to main content

Typography

Typography tokens are used to maintain a consistent set of font styles throughout your app.

Font family

The font family properties are used to specify a prioritized list of font family names.

The system font stack is used by default:

  • Segoe UI on Windows
  • Roboto on Android and Chrome OS
  • San Francisco on macOS and iOS
  • On other systems, Helvetica, Arial are used as fallbacks.

You can apply or change the font family using the --dwc-font-family custom property.

Example

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

Variables

VariableDefault ValueExample
--dwc-font-family-sans-apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'Sphinx of black quartz, judge my vow.
--dwc-font-family-monoMenlo, Monaco, 'Courier New', monospaceSphinx of black quartz, judge my vow.
--dwc-font-familyvar(--dwc-font-family-sans)Sphinx of black quartz, judge my vow.

Font size

The font size properties define a set of font sizes to choose from. s is the standard size, and is used by most components by default. All font sizes are defined in em.

EM Unit

em is a relative length unit. it's relative to font size of the parent, in the case of typographical properties like font-size, and font size of the element itself and in the case of other properties like width.

Example

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

Variables

VariableDefault ValueExample
--dwc-font-size-2xs0.75remAa
--dwc-font-size-xs0.813remAa
--dwc-font-size-s0.875remAa
--dwc-font-size-m1remAa
--dwc-font-size-l1.125remAa
--dwc-font-size-xl1.375remAa
--dwc-font-size-2xl1.75remAa
--dwc-font-size-3xl2.25remAa
--dwc-font-sizevar(--dwc-font-size-s)Aa

Font weight

The font-weight CSS property sets the weight (or boldness) of the font.

Example

p {
font-weight: var(--dwc-font-weight-semibold);
}
VariableDefault ValueExample
--dwc-font-weight-lighter200Aa
--dwc-font-weight-light300Aa
--dwc-font-weight-normal400Aa
--dwc-font-weight-semibold500Aa
--dwc-font-weight-bold700Aa
--dwc-font-weight-bolder800Aa

Line height

The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text.

Example

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

Variables

VariableDefault ValueExample
--dwc-font-line-height-2xs0.95Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-xs1.1Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-s1.25Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-m1.375Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-l1.5Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-xl1.75Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-height-2xl2Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.
--dwc-font-line-heightvar(--dwc-font-line-height-m)Sphinx of black quartz, judge my vow.
Sphinx of black quartz, judge my vow.