PageHeader
PageHeader is used to indicate the title of the current screen and can also provide additional content and actions that relate to the current screen as a whole.
Props
Usage guidelines
- To inform a user about the overall content of a page
- As a header for an overlay surface like a Modal, Popover or Sheet
- As page navigation
- As a title for sections inside of a page—there should only be one page header on a page
- As a toolbar
Best practices
Use only one primary action style in PageHeader. This should also be the only primary action on the page.
Use more than one primary action style in PageHeader, or include a primary action when there’s already a primary action elsewhere on the page. If there's already a primary action elsewhere on the page, PageHeader can have 1 or 2 secondary actions.
Plan for most PageHeaders to be full width. A maxWidth
should only be supplied when the content of the page is center aligned. The PageHeader’s padding should match the page’s overall padding.
Provide maxWidth
for PageHeader content that is different from the page content
Include an image when unique to the page content, such as a page dedicated to a developer’s apps
Include a profile avatar image in PageHeader, as the user avatar should be provided in the main app navigation
Keep additional help buttons and links to a minimum, choosing one source of help per PageHeader
Overload PageHeader with a help IconButton, help Link and info Tooltips. Too many sources of help on the page may confuse users. If there are multiple items to explain, use the help IconButton to open a Sheet with further help. If you want to lead users to external documentation, add a help Link with the helperLink
prop.
Accessibility
Be sure to follow any accessibility guidelines for the components used within PageHeader. The heading within PageHeader will be rendered as a level 1 heading, so ensure there are no other level 1 headings present on the page. For headings level 2-6, use Headings. Learn more about creating accessible headings.
Localization
Be sure to localize the badge
, dropdownAccessibilityLabel
, helperIconButton
, helperLink
, title
, subtext
, as well as any primaryAction
, secondaryAction
and item
components used within PageHeader.
Be brief with text in all components to account for languages with longer words.
Variants
Title
PageHeader's title
is the main part of the component as it represents the page's main heading (it will always be a level 1 heading). It can be complemented with three additional elements: a thumbnail (left) and a badge and/or a help Icon (right). Don't forget to localized its content.
Primary action
PageHeader supports an optional primaryAction
. It can be a Button, a Link or an IconButton with a Tooltip and optional Dropdown. Any Buttons or IconButtons should be size="lg"
.
If there's already a primary action elsewhere on the page, PageHeader can have 1 or 2 secondary actions. Use primaryAction
as an additional secondary action.
Primary and secondary actions are consolidated into Dropdown below the sm breakpoint. primaryAction
takes both the main component and its equivalent using Dropdown subcomponents.
For example, Button should be complemented with Dropdown.Item, Link should be complemented with Dropdown.Link, and an IconButton displaying a Dropdown should reuse the same Dropdown subcomponents. Don't forget to pass dropdownAccessibilityLabel
for the IconButton consolidating all actions into Dropdown below the sm breakpoint.
Resize your window to observe how the PageHeaders below adapt to smaller screen widths.
Secondary action
PageHeader also supports an optional secondaryAction
. It will likely be a Button or an IconButton with a Tooltip and optional Dropdown. Any Buttons or IconButtons should be size="lg"
.
Primary and secondary actions are consolidated into Dropdown below the sm breakpoint. secondaryAction
takes both the main component and its equivalent using Dropdown subcomponents.
For example, Button should be complemented with Dropdown.Item, Link should be complemented with Dropdown.Link, and an IconButton displaying a Dropdown should reused the same Dropdown subcomponents. Don't forget to pass dropdownAccessibilityLabel
for the IconButton consolidating all actions into Dropdown below the sm breakpoint.
Resize your window to observe how the PageHeaders below adapt to smaller screen widths.
Complementary items
PageHeader supports an optional pair of components next to the CTA section. It's strongly recommended to limit this space to data display components, mostly Datapoint. The complementary component section is hidden in small breakpoints.
Subtext
subtext
should be used to add metadata about the content on the page, not to describe the page itself. They can be complemented with a helperLink
.
Max width & border
A maxWidth
should only be supplied when the content of the page is center aligned. The PageHeader’s padding should match the page’s overall padding.
PageHeader also supports a bottom border to show the division between PageHeader and the page content below.
Responsive design
PageHeader is responsive to different web desktop breakpoints. Therefore, PageHeader’s behavior relies on the window size and requires PageHeader to be used on a full-window width to correctly respond to different breakpoints. Don’t use PageHeader right next to elements such as side-navigation bars that wouldn’t allow PageHeader to extend the full width of the window.
Writing
- Use sentences for titles capitalizing proper names and product names, including the word “Pin”
- Make sure page titles match the menu item that was used to navigate to the page
- Keep subtext short to account for localization and smaller screens
- Make page titles, subtext and action text lengthy so that it truncates quickly at smaller screen sizes
Related
Heading
Heading allows you to show headings on the page, therefore, it should be used to create level 2-6 headings on a page. If a level 1 heading is needed, use PageHeader. Use as a title for sections below PageHeader, or for when a page needs a title but doesn’t warrant a PageHeader.