Skip to main content

Header

Used to create a page header.

github
View source code

Migration Information

For teams migrating from the V1 to V2 component, please refer to the migration guide for changes to the component.
Component Guide
import { Header } from '@uhg-abyss/web/ui/Header';

Container​

Use the Container subcomponent of Header to wrap the main header row — the brandmark, actions, and other content that sit in the primary bar.

If your header also needs other rows alongside it, like a Header.UtilityBar or a Header.Navigation, don't nest them inside Container — that breaks its layout, since Container lays its children out in a single flex row. Wrap Container and those other rows together in Header.Root instead. Header.Root stacks full rows correctly and keeps everything inside one <header> landmark. See Header + NavMenu below.

Brandmark​

Use the Brandmark subcomponent of Header to customize brand mark in page header. Clicking on it will trigger a redirect to the home page. Below are the props for Brandmark subcomponent.

logo - prop to provide the logo that will be displayed on the far left side of the header. By default, it will show either the UHC, UHG or Optum logo, depending on the page theme.

Main content​

Use the MainContent subcomponent of Header to wrap the main content of the header. This is useful for adding additional elements like relevant buttons or other interactive components that will be placed on the right of the Brandmark.

Utility bar​

Use the UtilityBar subcomponent of Header inside Header.Root to show any additional content on the top header. This is an "open" container, where you can place utility dropdowns and links.

The example below showcases its use with our Dropdown and Link components.

Actions​

Use the Actions subcomponent of Header to show any additional content on the right side of the header. This is an "open" container that takes any children, such as a search box, buttons, or a set of links that provide secondary actions. The example below showcases its use with our DropdownMenu component.

Header + NavMenu​

When using these two components together, wrap Header.Container and Header.Navigation as siblings inside Header.Root. Header.Root stacks its children in the order given, so Header.Navigation renders as its own row below the main header row — and Header.Root alone renders the header's landmark element, keeping a single, correct landmark rather than a nested one.

Wrap the NavMenu around the Header.Navigation subcomponent. This gives the NavMenu a responsive design that "hides" on mobile screens (Note: The content is still rendered into the DOM for SEO purposes).

The Header.Navigation has a prop sticky that can be set to true to make the header navigation container sticky at the top of the viewport, or you can pass your own custom CSS properties.

Additionally, adding the Header.HamburgerMenu in to the Header.Actions component allows you to have an external state trigger to display/hide the mobile version of NavMenu

Note
  • Header.Container can still be used on its own (without Header.Root) exactly as before, for headers that don't need any additional rows.
  • Header.Root isn't specific to Header.Navigation — it stacks whatever children you give it, so it works with Header.UtilityBar, a custom navigation component, or any other row that needs to sit inside the same <header> landmark.

Here is an example for usage of the Header and NavMenu subcomponents (Note: Resize your browser window to visualize the change):

Full layout​

Shows a combination of the Header and the NavMenu in a full page.

Note

The sticky prop in the Header.Navigation is set to true in this example.

Header.Container Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header content

Below are the link(s) to the relevant GitHub type files:

Header.Brandmark Props​

NameTypeDefaultRequiredDescription
hideLogo
boolean | undefined
false
-
If true, the logo will be hidden
logo
React.ReactNode | undefined
--
The logo component that will be displayed on the left side of the Header. By default, it will show a brand logo based on the current theme
logoRedirect
string | undefined
--
The link that the logo will redirect to when clicked

Below are the link(s) to the relevant GitHub type files:

Header.MainContent Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header content

Below are the link(s) to the relevant GitHub type files:

Header.UtilityBar Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Utility Bar content

Below are the link(s) to the relevant GitHub type files:

Header.Actions Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Actions children

Below are the link(s) to the relevant GitHub type files:

Header.Navigation Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Navigation Wrapper
menuActive
boolean | undefined
false
-
Open Navigation Menu
sticky
boolean | React.CSSProperties | undefined
false
-
Make the header navigation container sticky at the top of the viewport, or pass on your own custom css properties.

Below are the link(s) to the relevant GitHub type files:

Header.Root Props​

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header content. Typically a Header.Container followed by a Header.Navigation
(or a consumer-provided navigation element), rendered in the order given.

Below are the link(s) to the relevant GitHub type files:

Header.Drawer Props​

NameTypeDefaultRequiredDescription
bottomMenuItems
HeaderMenuItem[] | null | undefined
--
The items that will be formatted and displayed in a NavMenu directly under the Header
drawerPosition
'left' | 'right' | undefined
'left'
-
Whether the hamburger menu should be displayed on the left or right side of the Header
drawerSelection
DrawerSelection | undefined
--
The selected item in the drawer; typically the state returned from a useState call
extraDrawerContent
React.ReactNode | undefined
--
Extra content that will be rendered at the top of the Header drawer
model
string | undefined
--
The model of the drawer
setDrawerSelection
React.Dispatch<React.SetStateAction<DrawerSelection>>
-
Function to set the selected item in the drawer; typically the setter returned from a useState call
topMenuItems
HeaderMenuItem[] | null | undefined
--
The items that will be formatted and displayed in a NavMenu at the top right of the Header

Below are the link(s) to the relevant GitHub type files:

NameTypeDefaultRequiredDescription
href
string | undefined
--
The URL to navigate to when the link is clicked. Note that this takes precedence over the |path prop.
onClick
() => void | undefined
--
The function to call when the link is clicked
path
string | undefined
--
The path to navigate to when the link is clicked. This is used on conjunction with a StateRouter.
routerComponent
React.ComponentType<any> | undefined
--
Custom router component to use for client-side navigation
(e.g., Next.js Link, Gatsby Link, etc.)
title
string
-
The text to display in the link

Below are the link(s) to the relevant GitHub type files:

Header.Container Classes​

Class NameDescription
.abyss-header-rootRoot element
.abyss-header-containerContainer element

Header.Brandmark Classes​

Class NameDescription
.abyss-header-logo-containerLogo container element
.abyss-header-logo-tooltipLogo tooltip element
.abyss-header-logoLogo element

Header.MainContent Classes​

Class NameDescription
.abyss-header-main-contentHeader main content element

Header.UtilityBar Classes​

Class NameDescription
.abyss-header-utility-bar-rootRoot element
.abyss-header-utility-bar-containerUtility Bar element

Header.Actions Classes​

Class NameDescription
.abyss-header-actionsRoot element

Header.HamburgerMenu Classes​

Class NameDescription
.abyss-header-expand-buttonHamburger menu button element

Header.Navigation Classes​

Class NameDescription
.abyss-header-navigation-rootRoot element

Header.Root Classes​

Class NameDescription
.abyss-header-root-rootRoot element

Header.Drawer Classes​

Class NameDescription
.abyss-header-drawer-menu-mainMain menu container
.abyss-header-drawer-horizontal-ruleHorizontal rule between menus
.abyss-header-drawer-menu-subSub menu container
.abyss-header-drawer-headerHeader container
.abyss-header-drawer-back-button-containerBack button container
.abyss-header-horizontal-ruleHorizontal rule in header
.abyss-header-drawer-selected-menu-nameSelected menu name text
.abyss-header-drawer-selection-contentSelected menu content container
.abyss-header-expand-buttonExpand button container
.abyss-header-drawer-menu-itemMenu item container
.abyss-header-drawer-menu-item-buttonMenu item button

Class NameDescription
.abyss-header-drawer-menu-item-buttonMenu item button

Keyboard Interactions​

KeyDescription
TabMoves focus to the next focusable element
EnterIf the logo is selected, redirects to the specified link. If focus is inside the navigation menu, redirects to the link if the menu bar item is a redirect, or opens the relevant dropdown menu if the item has one
SpaceIf focus on a menu bar item with a dropdown, opens the relevant dropdown menu
Left ArrowWhen focus is inside one of the navigation menus, focuses the previous menu bar item
Up ArrowWhen focus is inside one of the navigation menus, focuses the previous menu bar item
Right ArrowWhen focus is inside one of the navigation menus, focuses the next menu bar item
Down ArrowWhen focus is inside one of the navigation menus, focuses the next menu bar item. If focus is on an open menu bar item, moves focus into its dropdown menu
EscapeCloses open dropdown menu and moves focus to its menu bar item
HomeIf inside a navigation menu, moves focus to the first item in the menu
EndIf inside a navigation menu, moves focus to the last item in the menu

Component Tokens​

Tip

Click on the token row to copy the token to your clipboard.

Header Tokens​

Token NameValue
header.color.surface.header-container
#FFFFFF
header.color.surface.utility-bar
#F3F3F3
header.color.icon.utility.rest
#196ECF
header.color.icon.utility.hover
#004BA0
header.color.icon.utility.active
#002677
header.spacing.gap.horizontal.actions
16px
header.spacing.gap.horizontal.main-content
16px
header.spacing.padding.horizontal.header-container.rest
24px
header.spacing.padding.horizontal.header-container.mobile
16px
header.spacing.padding.horizontal.main-content.rest
16px
header.spacing.padding.horizontal.main-content.mobile
16px
header.spacing.padding.horizontal.utility-bar.rest
40px
header.spacing.padding.horizontal.utility-bar.mobile
12px
header.spacing.padding.vertical.header-container.rest
24px
header.spacing.padding.vertical.header-container.mobile
16px
header.spacing.padding.vertical.utility-bar
8px
Table of Contents