When to use
Section titled “When to use”Heading is for page and section titles. Screen reader users move between headings to learn the structure of the page.
When not to use
Section titled “When not to use”- For large text: Do not use Heading only to make text look big; it adds a wrong heading to the document structure. Use Text for body copy.
- For labels: Use Text or the matching component for form field labels and card titles outside the page structure.
- To skip levels: Do not put
h4afterh2.
Anatomy
Section titled “Anatomy”Heading has one part: the <h1>-<h6> element chosen by level.
- Root: a semibold type style, the
color-text-defaultcolour, and balanced line breaks withtext-balance.
Behaviour
Section titled “Behaviour”levelis required; leaving it out fails type checking.- When
sizeis not given it comes from the level: 1xl(32 px), 2lg(24 px), 3md(20 px), 4-6sm(16 px). sizechanges the visual only; the level and document structure stay withlevel.- A heading wraps and is never truncated.
- Margin is zero (
m-0); the surrounding Stack sets the spacing.
Guidelines
Section titled “Guidelines”Choose the level for the structure
Section titled “Choose the level for the structure”Heading sample
Subheading sample
Heading sample
Subheading sample
Change the size, not the level, for looks
Section titled “Change the size, not the level, for looks”If an h3 should look bigger, do not lower level; set size.
Content
Section titled “Content”- A heading tells the content below it at a glance; write it short and in sentence case.
- Keep one
h1per page. - Make headings at the same level different from each other.