Headings
The three roles that set titles, in real text, with class, size, line height, tracking and weight on a desktop and on a phone.
Three roles of the type scale set titles: display, heading and title. Each carries its own weight, and the two largest tighten their tracking, so the class by itself is enough.
A role is a size, not a level. The samples here are paragraphs set in a role's class, and
which element carries a role (h1, h2) is for the page's outline to decide.
Every screen is set from one scale of seven sizes
--type-display1.5rem1.5rem--type-display-leadingcalc(32 / 24)1.25--type-display-tracking--text-2xl--font-weightA heading names the part of the page beneath it
--type-heading1.25rem1.25rem--type-heading-leading1.41.3--type-heading-tracking--text-xl--font-weightA title opens a dialog, a card or a section
--type-title1rem1rem--type-title-leading1.5calc(22 / 16)--text-lg--font-weightThe values in full colour are the ones that apply at this width. The phone values apply
where (max-width: 767px) matches.
Wrapping
The item sets text-wrap: balance on
h1, h2 and h3, so a title that takes two lines takes two of about the same length.
Classes
The scale keeps Tailwind's names for sizes and gives them its own values. The item clears every size Tailwind ships before it defines its seven, so a class from outside the scale sets no size at all.
- The scale
text-2xs11pxtext-xs12pxtext-sm13pxtext-base14pxtext-lg16pxtext-xl20pxtext-2xl24px- Cleared
--text-*: initialremoves every size Tailwind ships. These set nothing:text-3xltext-4xltext-5xltext-6xltext-7xltext-8xltext-9xl- Also a size
text-touchmax(16px, 1rem)A size for the text of a field under a finger. It is not a role.
The heading component
Heading is a Registry component for titles. Two of its sizes are built from the scale's classes and step up with the width of the screen.
Invoices this month
size="card"text-lg md:text-xl lg:text-2xl
Due this week
size="inline"text-base md:text-lg
display-xl asks for text-[clamp(3.5rem,7.5vw,9rem)]; display asks for text-3xl, text-4xl, text-5xl, text-6xl; section asks for text-3xl, text-4xl, text-5xl. None of those is a class of the scale. How the component's largest sizes should be set is an open point, so they are not shown as part of it.