Headings
The five heading roles, each with its size and weight fixed.
Overview
Any title on a page: the public headline, the page title, a section, a subsection, a dialog.
Scale
Quotes
Open
Awaiting reply
Three quotes are waiting on the customer.
import {
Body,
PageHeading,
SectionHeading,
Stack,
SubsectionHeading,
} from "@hackcove/ui";
<Stack gap="sm">
<PageHeading>Quotes</PageHeading>
<SectionHeading rule>Open</SectionHeading>
<SubsectionHeading>Awaiting reply</SubsectionHeading>
<Body as="p">Three quotes are waiting on the customer.</Body>
</Stack>PageHeading names the page, SectionHeading its parts and SubsectionHeading what is inside a part.Quotes
Three quotes are waiting on the customer.
Open
Two quotes are open.
import { Body, PageHeading, Stack } from "@hackcove/ui";
<Stack gap="sm">
<PageHeading>Quotes</PageHeading>
<Body as="p">Three quotes are waiting on the customer.</Body>
<PageHeading>Open</PageHeading>
<Body as="p">Two quotes are open.</Body>
</Stack>PageHeading is an h1, and a page has one. A second one for a section breaks the outline: use SectionHeading.Hero
Tools for people who build
The supporting sentence that sits under the headline.
import { Display, Lead, Stack } from "@hackcove/ui";
<Stack gap="xs">
<Display>Tools for people who build</Display>
<Lead>The supporting sentence that sits under the headline.</Lead>
</Stack>Display is the one headline at the top of a public page, with a Lead under it.Dashboard
Recent activity
Nothing has changed since yesterday.
import { Body, Display, PageHeading, Stack } from "@hackcove/ui";
<Stack gap="sm">
<PageHeading>Dashboard</PageHeading>
<Display as="h2">Recent activity</Display>
<Body as="p">Nothing has changed since yesterday.</Body>
</Stack>Display is marketing scale, not a section title: inside a page it dwarfs everything around it. Use SectionHeading.Usage
- A page has one title:
PageHeadingfor an app page,Displayfor the headline of a public page. APageHeaderalready draws thePageHeadingand its subtitle, so use it for the top of a page. - Name the parts of a page with
SectionHeading;ruleputs the hairline under it, with the space either side built in. - Name what is inside a part with
SubsectionHeading:sizesm(default) is a form-group caption,basea card title in a header bar,lga drawer title. ModalHeadingis the title of a dialog or drawer, andDialogandDrawerdraw it from theirtitle. Do not place one on a page.- Put a
Leadunder aDisplay, and aSubtitleunder any other heading. - Pick the heading for its place in the outline, never for its size.
Displayis not a bigSectionHeading. colortakesdefault,secondary,tertiary,mutedorbrandfor the hierarchy of the text. A heading's meaning is carried by its words, not a colour.aschanges the element, only to keep the outline in order, and never the look.
Accessibility
- Each heading renders a real heading element:
DisplayandPageHeadinganh1,SectionHeadingandModalHeadinganh2,SubsectionHeadinganh3. asswaps the element and keeps the look, so the outline can follow the page without a visual change.id,aria-*anddata-*go on the heading element.DialogandDrawerdraw their ownModalHeadingand name themselves by it; anEmptyStatedraws itsSectionHeadingthe same way.
API
Display
Marketing-scale headline — the one line at the top of a public page. h1, text-4xl/tight semibold, primary text, growing to text-6xl on wider screens. PageHeading's scale is deliberately dev-tool sized; a brochure hero needs a display scale, so it gets its own pinned role rather than callers overriding PageHeading's size.
as- Type
ElementType
colorColour token; each component sets a sensible default.
- Type
"brand" | "default" | "muted" | "secondary" | "tertiary"
PageHeading
Page title. h1, text-2xl/8 semibold, primary text.
as- Type
ElementType
colorColour token; each component sets a sensible default.
- Type
"brand" | "default" | "muted" | "secondary" | "tertiary"
SectionHeading
Top-level section header. h2, text-base/6 semibold, primary text. rule sets a hairline under it (the Divider line colour) with the space either side of the line built in.
as- Type
ElementType
colorColour token; each component sets a sensible default.
- Type
"brand" | "default" | "muted" | "secondary" | "tertiary"
rule- Type
boolean
SubsectionHeading
Nested header. h3, text-sm/5 semibold, primary text. size steps it up for a card, drawer or form-group title: sm (default), base (bold) or lg.
as- Type
ElementType
colorColour token; each component sets a sensible default.
- Type
"brand" | "default" | "muted" | "secondary" | "tertiary"
size- Type
"sm" | "lg" | "base"- Default
sm
ModalHeading
Dialog/modal title. h2, text-base/6 semibold, primary text.
as- Type
ElementType
colorColour token; each component sets a sensible default.
- Type
"brand" | "default" | "muted" | "secondary" | "tertiary"