DS0
Components

Heading

Renders semantic heading elements (h1–h6) with consistent styling and visual hierarchy.

Overview

Heading renders semantic HTML heading elements (<h1> through <h6>) with consistent typography. The visual size can be decoupled from the semantic level, allowing you to use the correct heading hierarchy while controlling the visual presentation independently.

h1Heading 1 — Page Title
h2Heading 2 — Section
h3Heading 3 — Subsection
h4Heading 4 — Group
h5Heading 5 — Label
h6Heading 6 — Overline

Usage


export function Example() {
  return <Heading as="h1">Page Title</Heading>;
}

Levels

Each heading level maps to a default visual size:

LevelDefault SizeUse When
h14xlPage titles
h23xlSection titles
h32xlSubsection titles
h4xlGroup titles
h5lgSub-group titles
h6mdSmall titles
<Heading as="h1">Page Title</Heading>
<Heading as="h2">Section Title</Heading>
<Heading as="h3">Subsection Title</Heading>

Size Override

Decouple visual size from semantic level:

<Heading as="h3" size="4xl">
  Visually large, semantically h3
</Heading>

States

Weight

<Heading weight="regular">Regular</Heading>
<Heading weight="semibold">Semibold</Heading>
<Heading weight="bold">Bold</Heading>

Tracking

<Heading tracking="tighter">Tight Tracking</Heading>
<Heading tracking="normal">Normal Tracking</Heading>

Accessibility

Screen Reader

  • Renders the correct semantic heading element (<h1> through <h6>)
  • Screen readers use heading levels to build a page outline for navigation
  • Heading levels should not skip (e.g., h1h3 without h2)

ARIA

No special ARIA attributes needed — semantic HTML handles accessibility.

API Reference

Props

PropTypeDefaultDescription
as'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6''h2'The semantic heading level
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'Auto from levelOverride visual size
weight'regular' | 'medium' | 'semibold' | 'bold''bold'Font weight
tracking'tighter' | 'tight' | 'normal''tight'Letter spacing
classNamestringAdditional CSS classes
childrenReactNodeHeading text (required)

AI Decision Guide

Use Heading when:

  • Displaying page titles, section titles, or subsection titles
  • Creating visual hierarchy in content

Don't use Heading when:

  • Styling non-heading text to look like a heading → use Text with appropriate weight
  • Labels for form fields → use Label
  • Body text or paragraphs → use Text
ComponentWhen to Use Instead
TextFor body text, paragraphs, and non-heading content
LabelFor form input labels

On this page