Skip to content

PageHeader

PageHeader is used to determine the arrangement of the top-level headings and how elements adopt to different viewports.
  • Draft
  • Not reviewed for accessibility
import {PageHeader} from '@primer/react/drafts'

Examples

Has title only

Title variant="large"

With leading and trailing visuals

With leading visual is hidden on regular viewport

With leading and trailing actions

With actions

With description slot

With navigation slot

With ContextArea

With context bar and actions (only visible on mobile)

With a ContextArea with all possible children (always visible)

With actions that have responsive content

Props

NameTypeDefaultDescription
aria-label
string | undefined
A unique label for the rendered main landmark
as
React.ElementType
"header"The underlying element to render — either a HTML element name or a React component.
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.ContextArea

ContextArea should be used to provide users contextual information about their navigation journey. It is only visible on narrow viewports by default.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.ContextArea Children

ParentLink is the default way to let users navigate up in the hierarchy on narrow viewports.

NameTypeDefaultDescription
href
string
The URL to link to.
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
{ narrow: false regular: true wide: true }Whether the parent link is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.ContextBar

ContextBar is a generic slot for any component above the title region. Use it for custom breadcrumbs and other navigation elements instead of ParentLink.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.ContextAreaActions

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.TitleArea

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.
variant
| 'subtitle'
| 'medium' | 'large'
| {
    narrow?:
      | 'subtitle'
      | 'medium' 
      | 'large'
    regular?:
      | 'subtitle'
      | 'medium' 
      | 'large'
    wide?:
      | 'subtitle'
      | 'medium' 
      | 'large'
  }
mediumDefault title (medium) is the most common page title size. Use for static titles in most situations. Large variant should be used for user-generated content such as issues, pull requests, or discussions. Subtitle variant can be used when a PageHeader.Title is already present in the page, such as in a SplitPageLayout.

PageHeader.TitleArea Children

PageHeader.LeadingAction

Leading actions can be used for local navigation. It is hidden on narrow viewports by default in favor of ParenLink.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.LeadingVisual

Leading visuals are optional and appear at the start of the title. They can be octicons, avatars, and other custom visuals that fit a small area.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.Title

NameTypeDefaultDescription
as
React.ElementType
"h3"The underlying element to render — either a HTML element name or a React component.
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.TrailingVisual

Trailing visual and trailing text can display auxiliary information. They're placed at the right of the item, and can denote status, privacy details, etc.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.TrailingAction

Trailing action can display subtler actions aligned directly next to the title. It is hidden on narrow viewports by default. Replace the trailing action with an item in an overflow button on narow viewports.

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.Actions

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.Description

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

PageHeader.Navigation

NameTypeDefaultDescription
hidden
| boolean
| {
    narrow?: boolean
    regular?: boolean
    wide?: boolean
  }
falseWhether the content is hidden.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

Status

Alpha

  • Component props are documented on primer.style/react.
  • Component does not have any unnecessary third-party dependencies.
  • Component can adapt to different themes.
  • Component can adapt to different screen sizes.
  • Component has 100% test coverage.

Beta

  • Component is used in a production application.
  • Common usage examples are documented on primer.style/react.
  • Common usage examples are documented in storybook stories.
  • Component has been reviewed by a systems designer and any resulting issues have been addressed.
  • Component has been manually reviewed by the accessibility team and any resulting issues have been addressed.

Stable

  • Component API has been stable with no breaking changes for at least one month.
  • Feedback on API usability has been sought from developers using the component and any resulting issues have been addressed.
  • Component has corresponding design guidelines documented in the interface guidelines.
  • Component has corresponding Figma component in the Primer Web library.