v2.1.1

Heading

Installation

Install yarn add @spark-web/heading
Source GitHub.com
Bundle unpkg.com

Constrained, purposeful heading styles as a component.

Level

Controls the size of the heading and maps to the appropriate heading element (h1, h2, h3 or h4). The rendered element can be overridden with the as prop.

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Tone

Headings can be either "neutral" or "primary".

Heading neutral

Heading primary

Alignment

Text can be aligned with the align prop.

Left (default)

Center

Right

Truncation

Truncate text to a single line using the truncate prop. Useful for displaying user-generated content that may not fit within your layout.

The quick brown fox jumps over the lazy

Contrast

To ensure headings have sufficient contrast, when on a dark background the foreground colour is inverted.

This Heading is inverted to improve contrast.

Props

PropTypeDescription

level

"1" | "2" | "3" | "4"

The heading level.

align?

"left" | "center" | "right"

The horizontal alignment.

children?

ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

The text content.

data?

DataAttributeMap

Sets data attributes on the component.

id?

string

An identifier which must be unique in the whole document.

tone?

"neutral" | "muted" | "primary"

The tone of the text.

truncate?

boolean

Truncate text to a single line.

Extra props are passed into the underlying Box component.

© 2023 Brighte Capital Pty Ltd