Skip to main content

Typography

Open in ChatGPT

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 via system-ui, which automatically resolves to the platform's native font:

  • San Francisco on macOS and iOS
  • Segoe UI on Windows
  • Roboto on Android and Chrome OS

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 Value
--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)

Font size

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

REM Unit

rem is a relative length unit. It is relative to the font size of the root element (<html>), which defaults to 16px in most browsers.

Example

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

Variables

VariableDefault ValueComputed (at 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

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 Value
--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)

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 Value
--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)