On this page

Typography

Heading

Semantic heading with automatic level management.

Heading renders a semantic section heading. It reads its level from HeadingLevels context without advancing it. Set level to override it directly.

Heading: Basic
Loading Heading: Basic example

Heading level

Set base on the root HeadingLevels. Each nested HeadingLevels advances the next heading level. This keeps the document outline aligned with the component structure.

Heading: Automatic levels
Loading Heading: Automatic levels example

Use level to override the context for one heading. It does not change the level for siblings or children.

<Heading level={2}>Explicit h2</Heading>

Outside HeadingLevels, Heading falls back to h2. Nested contexts cap at h6.

When renderRoot owns the heading, use the callback's element and level state to return the resolved heading tag. This preserves automatic levels inside nested HeadingLevels contexts.

<Heading renderRoot={(domProps, { element: HeadingTag }) => <HeadingTag {...domProps} />}>
	Account settings
</Heading>

To read the current level in a custom heading-like component, use useHeadingLevel. Like Heading, it does not advance the level.

Do not skip levels, such as an h2 followed by an h4. Someone who uses a screen reader navigates a page by heading level.

Typography

By default, Heading maps h1–h4 to heading1–heading4, h5 to lead, and h6 to body, and uses the heading font-weight role. Set typography to change the visual style without changing the semantic level. Use display for oversized marketing-style headings.

Heading: Typography
Loading Heading: Typography example

Colour

Heading inherits the surrounding colour. Its color prop takes the same values as Text and reads the nearest Luke UI background the same way.

API

HeadingProps

HeadingProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.

NameTypeDefault
color
"accent" |⁠ "danger" |⁠ "info" |⁠ "neutral" |⁠ "primary" |⁠ "secondary" |⁠ "success" |⁠ "warning" |⁠ undefined—

Sets text colour from the nearest Luke UI background. On a solid background, every semantic role reads as that background's primary colour. Omit it to inherit the surrounding colour.

fontStyle
"default" |⁠ "inherit" |⁠ "italic" |⁠ "normal" |⁠ undefined'default'

Sets font style.

fontVariantNumeric
"default" |⁠ "diagonal-fractions" |⁠ "normal" |⁠ "ordinal" |⁠ "slashed-zero" |⁠ "tabular-nums" |⁠ undefined'default'

Sets numeric glyph style.

fontWeight
"body" |⁠ "emphasis" |⁠ "heading" |⁠ "label" |⁠ undefined'heading'

Sets the semantic font-weight role. Explicit values override the heading default.

isVisuallyHidden
booleanfalse

Hides text visually while keeping it accessible.

level
—

Heading level override. Inherits from context when omitted.

lineClamp
1 |⁠ 2 |⁠ 3 |⁠ 4 |⁠ 5 |⁠ boolean |⁠ undefined—

Clamps text lines. true clamps to 1 line; numeric values clamp to 1–5.

shouldDisableTrim
boolean |⁠ undefined—

Turns cap-height trim on or off. When omitted, trimming is disabled for inline or unknown element types. Line clamp always disables trim.

shouldInheritFont
boolean |⁠ undefinedfalse

Makes text inherit its surrounding font styles. Colour always inherits unless color is set.

textAlign
"center" |⁠ "end" |⁠ "start" |⁠ undefined'start'

Sets text alignment.

textDecoration
"inherit" |⁠ "line-through" |⁠ "none" |⁠ "underline" |⁠ undefined'none'

Sets text decoration.

textTransform
"capitalize" |⁠ "default" |⁠ "inherit" |⁠ "lowercase" |⁠ "none" |⁠ "uppercase" |⁠ undefined'none'

Sets text transform.

textWrap
"balance" |⁠ "default" |⁠ "pretty" |⁠ undefined'default'

Sets text wrapping behavior.

typography
"body" |⁠ "caption" |⁠ "display" |⁠ "heading1" |⁠ "heading2" |⁠ "heading3" |⁠ "heading4" |⁠ "label" |⁠ "lead" |⁠ undefined—

Applies a complete typography style: family, size, weight, line height, letter spacing, and trim. When omitted, the style follows the resolved heading level: heading1–heading4 for levels 1–4, lead for 5, and body for 6. The default level comes from HeadingLevels context when level is omitted.

HeadingLevelsProps

NameType
base

Base level override. Defaults to inherited level + 1.