Heading
Heading shows a title for a page, a section or a card in the heading font.
Use a Heading for the title of a page, a section or a card. For body text and labels, use Text. For a page title that moves into the toolbar when the page scrolls, use Page.
A Heading uses the same nine-step size scale as Text, so size="4" is the same size on both. On most screens, use size 8 for a page title, 7 for a section and 6 for a card title. The default size is 6.
Size and level are set separately. size sets how large the heading looks, and render sets the element and its level, such as render={<h1 />}. Without render, a Heading renders an <h2>.
The default weight is medium, and semibold is the heaviest weight available. emphasis sets how strong the text colour is. tone gives the words a meaning, such as destructive, and most headings leave it unset so the words match the surface they sit on.
A screen reader announces a heading with its level, and many people move through a page by its headings. Keep the levels in order, and change size rather than the level when a heading needs to look smaller.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
emphasis? | "loud" | "medium" | "quiet" | The emphasis level of the text, which sets its colour, as on Text. |
render? | RenderElement | Renders the heading as a different element. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | The text size step, from 1 to 9, the same steps as Text. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | The meaning of the heading, which sets its colour family, such as destructive. |
weight? | "regular" | "medium" | "semibold" | The font weight: regular, medium or semibold. |
It also takes every prop of a <h2>.