Heading

ID: mantra_starter:heading

Heading element.

Name Label Type Description
heading Heading Slot
heading_tag Heading tag Enum Default: "span"
Allowed values: span, h1, h2, h3, h4, h5, h6
heading_classes Heading classes Unknown ⚠️ {"type":"array"}

Default

The tag is a prop rather than a fixed element, so the same component can sit at whatever level the surrounding document has reached. The story renders h1 and the wrapper adds h2 to h6 below it, so the whole scale is on one page.

H1 Heading

H2 Heading

H3 Heading

H4 Heading

H5 Heading
H6 Heading

Formatted

The h2 to h4 scale inside `.text-formatted`, the class Drupal puts on formatted text fields. It starts at h2 because body text sits below the page title, which is the only h1. Comparing it with the default story shows what the formatted-text typography does to each heading level.

H2 Heading

H3 Heading

H4 Heading

Span

The default tag. A heading that looks like one but must not enter the document outline -- the label of a list, say -- is a span. A span has no size of its own, so `heading_classes` gives it one.

A heading rendered as span

With classes

`heading_classes` is added to the element's attributes, so a caller can size a heading without the component knowing anything about the scale.

A heading rendered as h3, sized by its classes