PageHeader
The top of a page: breadcrumbs, title, subtitle, actions and tabs.
Overview
The first block of every page; it puts the page's first content at the same y on every page.
Slots
Do
Build 412
main · 3 changed
import { Breadcrumbs, Button, NavTabs, PageHeader } from "@hackcove/ui";
<PageHeader
breadcrumbs={
<Breadcrumbs
crumbs={[
{ label: "Hack Cove", href: "#project" },
{ label: "Builds", href: "#builds" },
"Build 412",
]}
/>
}
title="Build 412"
subtitle="main · 3 changed"
actions={
<>
<Button variant="outline">Reject</Button>
<Button>Accept all</Button>
</>
}
tabs={
<NavTabs
label="Build"
items={[
{ label: "Changed", href: "#changed", active: true },
{ label: "New", href: "#new" },
]}
/>
}
/>PageHeader; each is optional.Don't
Build 412
main · 3 changed
import { Button, Cluster, PageHeading, Stack, Subtitle } from "@hackcove/ui";
<Cluster justify="between">
<Stack gap="xs">
<PageHeading>Build 412</PageHeading>
<Subtitle>main · 3 changed</Subtitle>
</Stack>
<Button>Accept all</Button>
</Cluster>Cluster is a second header that drifts from every other page's. Use PageHeader.In stack
Do
Members
Who can see this project.
Active
import { Body, Card, PageHeader, Stack } from "@hackcove/ui";
<Stack gap="lg">
<PageHeader title="Members" subtitle="Who can see this project." />
<Card title="Active">
<Body>3 members</Body>
</Card>
</Stack>Stack, the header drops its own bottom margin, so the Stack's gap is the only space under it.Don't
Members
Who can see this project.
Active
import { Body, Card, PageHeader, Stack } from "@hackcove/ui";
<Stack gap="lg">
<div>
<PageHeader title="Members" subtitle="Who can see this project." />
</div>
<Card title="Active">
<Body>3 members</Body>
</Card>
</Stack>div, the header is no longer a direct child of the Stack, keeps its margin and doubles the space.Usage
- Pass
title, andsubtitle,breadcrumbs,actionsandtabsas needed; never build a title row from a heading and aCluster. actionssit beside the title fromsmup and under it on a phone: aButtonor two, one primary.breadcrumbstake aBreadcrumbs;tabstake aNavTabs(links to pages).- Its fixed bottom margin gives every page the same first-block position. As a direct child of a
Stackit has none and the Stack'sgapis the only space, so do not wrap it in another element. - One
PageHeaderper page: it holds the page's<h1>.
Accessibility
- The title is the page's
<h1>; the subtitle is a paragraph. Breadcrumbsis a<nav>named Breadcrumb, with the last crumb markedaria-current="page". GiveNavTabsalabel.- On a narrow screen the actions move below the title.
API
PageHeader
The top of a page: breadcrumbs, title, subtitle, actions and tabs. Its fixed bottom margin puts every page's first block at the same y; as a direct child of a Stack it has none, so the Stack's gap is the only space under it.
actionsRight of the title on sm and up, below it on a phone.
- Type
ReactNode
breadcrumbsA Breadcrumbs above the title.
- Type
ReactNode
subtitle- Type
ReactNode
tabsA NavTabs (or similar) under the title.
- Type
ReactNode
title required- Type
ReactNode