Skip to content

Material 3

Theme

Typography

The type scale, typefaces and font weights.

Set a Material 3 type style with one class, such as text-headline-sm or text-body-lg. The class sets the font size, the line height, the tracking and the weight together. The typefaces, Roboto by default, and the font weights have classes of their own.

Type scale

The theme's type follows Material's type scale: fifteen baseline styles, five roles in three sizes each, and an emphasized style for each of them. A style's class is text-<role>-<size>, with lg, md or sm for the size.

Display largetext-display-lg
Display mediumtext-display-md
Display smalltext-display-sm
Headline largetext-headline-lg
Headline mediumtext-headline-md
Headline smalltext-headline-sm
Title largetext-title-lg
Title mediumtext-title-md
Title smalltext-title-sm
Body largetext-body-lg
Body mediumtext-body-md
Body smalltext-body-sm
Label largetext-label-lg
Label mediumtext-label-md
Label smalltext-label-sm

A type style is one of Tailwind's font size utilities, and is used like any other:

  • Color: A style sets no color. Add a color role next to it, as in text-title-md text-on-surface. Material's default color for text is on-surface, with on-surface-variant for less emphasis.
  • Window size: Add a breakpoint variant for another style in a larger window, as in text-headline-lg expanded-screen:text-display-sm.
  • Single properties: To change the weight, the line height or the tracking of a style on one element, add that property's own class, in any order: a font weight, or one of Tailwind's leading-* and tracking-* classes. Use the class in place of a line height modifier, such as text-body-lg/7, which sets the size and the line height alone.
  • Your own CSS: Apply a style with Tailwind's @apply, as in @apply text-title-md.
  • Merged classes: tailwind-merge reads a type style as a text color, and keeps only the last of the two. To merge them, use the tv or the twMerge that @material-web/react exports, which keep both.

Type roles

A role is named after its use. Each has a large, a medium and a small size.

RoleUse
displayThe largest text on the screen, reserved for short, important text or numerals
headlineShort, high-emphasis text on smaller screens
titleMedium-emphasis text that remains relatively short
bodyLonger passages of text
labelText inside components, and very small text in the content body, such as captions

Type styles

ClassSizeLine heightTrackingWeight
text-display-lg57px64px-0.25pxregular
text-display-md45px52px0regular
text-display-sm36px44px0regular
text-headline-lg32px40px0regular
text-headline-md28px36px0regular
text-headline-sm24px32px0regular
text-title-lg22px28px0regular
text-title-md16px24px0.15pxmedium
text-title-sm14px20px0.1pxmedium
text-body-lg16px24px0.5pxregular
text-body-md14px20px0.25pxregular
text-body-sm12px16px0.4pxregular
text-label-lg14px20px0.1pxmedium
text-label-md12px16px0.5pxmedium
text-label-sm11px16px0.5pxmedium

The sizes and the line heights are in rem, so they follow the reader's font size. The pixel values in the table are those at the browser's default of 16px.

To change a style's values, see Custom type styles.

Emphasized styles

Every style has an emphasized one, with the same size, line height and tracking in a heavier weight. Add -emphasized to the style's class, as in text-title-md-emphasized.

Headline smallHeadline small emphasizedTitle mediumTitle medium emphasizedBody largeBody large emphasizedLabel largeLabel large emphasized
export default function TypeEmphasized() {
  return (
    <div className="grid w-full grid-cols-2 gap-x-space-300 gap-y-space-150">
      <span className="text-headline-sm">Headline small</span>
      <span className="text-headline-sm-emphasized">Headline small emphasized</span>
      <span className="text-title-md">Title medium</span>
      <span className="text-title-md-emphasized">Title medium emphasized</span>
      <span className="text-body-lg">Body large</span>
      <span className="text-body-lg-emphasized">Body large emphasized</span>
      <span className="text-label-lg">Label large</span>
      <span className="text-label-lg-emphasized">Label large emphasized</span>
    </div>
  )
}
StylesWeightEmphasized weight
Display, headline, body and text-title-lgregularmedium
Label, text-title-md and text-title-smmediumbold

Use the emphasized styles together with the baseline ones, for the text that should stand out. Material recommends them for selection, actions and headlines.

Typefaces

A type style sets no typeface. Use font-brand or font-plain, the theme's two font families, both Roboto by default.

Class and tokenUse
font-brand
--md-ref-typeface-brand
Larger type styles, like headline and display, to focus on expression
font-plain
--md-ref-typeface-plain
Smaller type styles, like body and label, to focus on readability

The theme does not set the page's typeface. Add the plain typeface and a body style to the body, next to the page's color roles:

<body class="bg-surface font-plain text-body-lg text-on-surface"></body>

No font is bundled. Load Roboto in the weights 400, 500 and 700, as Installation shows. To use other typefaces, see Custom fonts.

Font weights

Use font-regular, font-medium and font-bold for the three weights of the type scale, alone or over the weight of a type style, as in text-body-lg font-medium.

ClassTokenWeight
font-regular--md-ref-typeface-weight-regular400
font-medium--md-ref-typeface-weight-medium500
font-bold--md-ref-typeface-weight-bold700

font-medium and font-bold are Tailwind's own font weight classes, which follow the tokens here. Tailwind's other weights, such as font-semibold, are unchanged.

To change the weights, see Custom weights.

Icon font

Use font-icon for the icon font, Material Symbols Outlined by default. Like Roboto, it is not bundled: load it as Installation shows.

The theme has a font size for each Material icon size, with a line height of 1, and a tracking of exactly 0, which the ligature of an icon needs. Each is a Tailwind theme variable, and a size has a second one for its line height, as a type style has:

ClassTheme variablesDefault
font-icon--font-iconMaterial Symbols Outlined
text-icon-18--text-icon-18
--text-icon-18--line-height
1.125rem, 18px
1
text-icon-20--text-icon-20
--text-icon-20--line-height
1.25rem, 20px
1
text-icon-24--text-icon-24
--text-icon-24--line-height
1.5rem, 24px
1
text-icon-28--text-icon-28
--text-icon-28--line-height
1.75rem, 28px
1
text-icon-32--text-icon-32
--text-icon-32--line-height
2rem, 32px
1
text-icon-36--text-icon-36
--text-icon-36--line-height
2.25rem, 36px
1
text-icon-40--text-icon-40
--text-icon-40--line-height
2.5rem, 40px
1
text-icon-48--text-icon-48
--text-icon-48--line-height
3rem, 48px
1
tracking-0--tracking-00px

For the classes that set an icon's size, fill and weight, see the Icon component. To use another icon font, see Custom fonts.

Custom typography

Every typeface, weight and type style is a custom property, so your own CSS can set it after the import. A value set before the import is replaced by the theme's.

To change the type of one component instead, pass a type style, a typeface or a weight class in its className, as in <Button className="font-brand">.

Custom fonts

To change the typefaces, set --md-ref-typeface-brand and --md-ref-typeface-plain on the root. For another icon font, set --font-icon:

@import 'tailwindcss';
@import '@material-web/tailwind';

:root {
  --md-ref-typeface-brand: 'Google Sans', sans-serif;
  --md-ref-typeface-plain: 'Inter', sans-serif;
  --font-icon: 'Material Symbols Rounded';
}
Token and theme variableDefault
--md-ref-typeface-brand
--font-brand
Roboto, ui-sans-serif, system-ui, sans-serif
--md-ref-typeface-plain
--font-plain
Roboto, ui-sans-serif, system-ui, sans-serif
--font-icon'Material Symbols Outlined Variable', 'Material Symbols Outlined'

Under a typeface's token is its Tailwind theme variable, which gives the token its class. In your own CSS, read the token, as in var(--md-ref-typeface-brand): a theme variable has the root's value, and does not follow a token set on an element. The icon font is a theme variable alone.

No font is bundled, so load the ones you name. The components are set in the plain typeface, so the brand typeface shows only where you add font-brand.

Custom weights

For a typeface that comes in other weights, set the weight tokens on the root as well:

:root {
  --md-ref-typeface-weight-regular: 400;
  --md-ref-typeface-weight-medium: 600;
  --md-ref-typeface-weight-bold: 800;
}
Token and theme variableDefault
--md-ref-typeface-weight-regular
--font-weight-regular
400
--md-ref-typeface-weight-medium
--font-weight-medium
500
--md-ref-typeface-weight-bold
--font-weight-bold
700

Every type style and weight class follows them. As with the typefaces, read a weight's token in your own CSS, not its theme variable. Load the font in the weights you set. With a variable font, a weight can be any number in the font's range, such as 450.

Custom type styles

A type style is four theme variables. Its font size is --text- and the style's name, and the other three add --line-height, --letter-spacing or --font-weight to that, as in --text-body-lg--letter-spacing.

Set them in @theme. An emphasized style has four variables of its own, so set both styles. Another typeface may need another tracking, for example:

@import 'tailwindcss';
@import '@material-web/tailwind';

@theme {
  --text-body-lg--letter-spacing: 0;
  --text-body-lg-emphasized--letter-spacing: 0;
}

The table lists every style's font size variable with its default, then the defaults of its --line-height, --letter-spacing and --font-weight variables. The weights are the weight tokens: regular is var(--md-ref-typeface-weight-regular).

VariableFont sizeLine heightLetter spacingFont weight
--text-display-lg3.5625rem4rem-0.25pxregular
--text-display-md2.8125rem3.25rem0regular
--text-display-sm2.25rem2.75rem0regular
--text-headline-lg2rem2.5rem0regular
--text-headline-md1.75rem2.25rem0regular
--text-headline-sm1.5rem2rem0regular
--text-title-lg1.375rem1.75rem0regular
--text-title-md1rem1.5rem0.15pxmedium
--text-title-sm0.875rem1.25rem0.1pxmedium
--text-body-lg1rem1.5rem0.5pxregular
--text-body-md0.875rem1.25rem0.25pxregular
--text-body-sm0.75rem1rem0.4pxregular
--text-label-lg0.875rem1.25rem0.1pxmedium
--text-label-md0.75rem1rem0.5pxmedium
--text-label-sm0.6875rem1rem0.5pxmedium
--text-display-lg-emphasized3.5625rem4rem-0.25pxmedium
--text-display-md-emphasized2.8125rem3.25rem0medium
--text-display-sm-emphasized2.25rem2.75rem0medium
--text-headline-lg-emphasized2rem2.5rem0medium
--text-headline-md-emphasized1.75rem2.25rem0medium
--text-headline-sm-emphasized1.5rem2rem0medium
--text-title-lg-emphasized1.375rem1.75rem0medium
--text-title-md-emphasized1rem1.5rem0.15pxbold
--text-title-sm-emphasized0.875rem1.25rem0.1pxbold
--text-body-lg-emphasized1rem1.5rem0.5pxmedium
--text-body-md-emphasized0.875rem1.25rem0.25pxmedium
--text-body-sm-emphasized0.75rem1rem0.4pxmedium
--text-label-lg-emphasized0.875rem1.25rem0.1pxbold
--text-label-md-emphasized0.75rem1rem0.5pxbold
--text-label-sm-emphasized0.6875rem1rem0.5pxbold

For another weight, use a weight token as well, as in --text-title-lg--font-weight: var(--md-ref-typeface-weight-medium), so that the style follows your custom weights.

Material advises against changing the sizes, which changes how the components lay out.