Heading
The Heading component provides semantic heading levels with predefined typographic styles. Use Heading to create a clear typographic hierarchy for content organization.Installation
Usage
Props
Heading Props
| Prop | Type | Default | Description |
|---|---|---|---|
as | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'label' | 'span' | 'header' | - | Required. The HTML element to render. |
variant | 'heading10' | 'heading20' | 'heading30' | 'heading40' | 'heading50' | 'heading60' | 'heading20' | Required. Style variant to apply to the heading, affects the visual appearance. |
element | string | 'HEADING' | Overrides the default element name to apply unique styles with the Customization Provider. |
id | string | - | Same as the HTML id attribute. |
marginBottom | 'space0' | - | Currently we only allow space0 to remove bottom margin. |
display | TextProps['display'] | 'block' | CSS display property. |
Variants
The Heading component provides six variants with different sizes and spacing:- heading10: Largest heading (fontSize90, lineHeight90, marginBottom space70)
- heading20: Default, very large (fontSize70, lineHeight70, marginBottom space60)
- heading30: Large (fontSize60, lineHeight60, marginBottom space50)
- heading40: Medium (fontSize40, lineHeight40, marginBottom space30)
- heading50: Small (fontSize30, lineHeight30, marginBottom space30)
- heading60: Smallest (fontSize20, lineHeight20, marginBottom space30)
fontWeightSemibold and -0.02em letter spacing.
Examples
Basic Heading Variants
Removing Bottom Margin
UsemarginBottom="space0" to remove the default bottom margin:
Customization
The Heading component can be customized using the Customization Provider:Accessibility
- Use semantic HTML heading tags (
h1throughh6) to create a logical document outline - Don’t skip heading levels (e.g., don’t jump from
h1toh3) - Use headings to organize content, not just for visual styling
- Each page should have one
h1element