PageHeader
Library
Title only
With a subtitle
When to use
- The top of a page, with its main title.
- Primary actions are needed next to it: create, upload, open filters.
- On mobile the actions can wrap under the title automatically.
When not to use
- For a heading inside a card/section, use
SectionHeader. - For a modal title, use
Dialog/ModalHeader. - Do not use more than one
PageHeaderon one semantic page.
Minimal example
<PageHeader
title="Library"
subtitle="3,527 photos"
actions={<Button tone="accent">Upload</Button>}
/>Public API
title is required and accepts a ReactNode; it is rendered in an h1. subtitle and
actions are also of type ReactNode. The component accepts the other native div props,
including className and ref; the native title prop is deliberately excluded so that it does not
conflict with the required heading. On desktop the header lays its content out
in a row, on a narrow layout in a column; actions can wrap.
Accessibility and keyboard
The heading is always an h1, so the title text must be the name of the current
page, not an action verb. each action in actions must be an accessible control on its own;
PageHeader does not add an aria-label or handlers to them. See the
PageHeader source.
Good examples
titleas text or icon + text in one ReactNode.- The primary action in
actions, secondary actions next to it. subtitlewith a count or a short description of the page.
Anti-patterns
- A
titlewith a nested heading, even thoughPageHeaderalready creates theh1. - Overriding the
PageHeadertitle through the DOMtitleattribute. - Using actions as a place for unrelated global navigation.
Related sources and Storybook
src/components/navigation/PageHeader.tsxsrc/components/navigation/PageHeader.stories.tsx
TypeScript types
PageHeaderProps
Prop
Type
Plus DOM attributes, such as onChange, onClick, className — 278 in total; the table does not repeat them.