Skip to main content

Header

Used to create a page header.

Submit feedback
github

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 all other elements in the Header.

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 the Provider 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, the NavMenu needs to be wrapped around the Header.Navigation subcomponent. This ensures that the NavMenu has a responsive design, and "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

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
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.

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

Header.Brandmark Props

NameTypeDefaultRequiredDescription
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.
hideLogo
boolean
false
-
If true, the logo will be hidden
logo
React.ReactNode
--
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
--
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
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.

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

Header.UtilityBar Props

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Utility Bar content
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.

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

Header.Actions Props

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Actions children
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.

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

Header.Navigation Props

NameTypeDefaultRequiredDescription
children
React.ReactNode
-
Header Navigation Wrapper
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.
menuActive
boolean
false
-
Open Navigation Menu
sticky
boolean | React.CSSProperties
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.Drawer Props

NameTypeDefaultRequiredDescription
bottomMenuItems
HeaderMenuItem[] | null
--
The items that will be formatted and displayed in a NavMenu directly under the Header
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.
drawerPosition
"left" | "right"
'left'
-
Whether the hamburger menu should be displayed on the left or right side of the Header
drawerSelection
DrawerSelection
--
The selected item in the drawer; typically the state returned from a useState call
extraDrawerContent
React.ReactNode
--
Extra content that will be rendered at the top of the Header drawer
model
string
--
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
--
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:

Header.DrawerLink Props

NameTypeDefaultRequiredDescription
className
string
--
CSS class name to apply to each element within the component
css
Abyss.CSSProperties | Partial<Record<`abyss-${T}`, Abyss.CSSProperties>>
--
Object containing CSS styling to apply; uses the classes listed in the "Integration" tab of the component's documentation

See CSS Prop Styling for more information
data-testid
string
--
Suffix used to create a unique ID used for automated testing

See Component Testing for more information
disableDefaultProviderProps
boolean
false
-
If set to true, the component will not use the DefaultPropsProvider values.

If you aren’t using the DefaultPropsProvider, this prop can be ignored.
href
string
--
The URL to navigate to when the link is clicked. Note that this takes precedence over the {@link pathpath} prop.
onClick
() => void
--
The function to call when the link is clicked
path
string
--
The path to navigate to when the link is clicked. This is used on conjunction with a StateRouter.
routerComponent
React.ComponentType<any>
--
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.Hamburger Classes

Class NameDescription
.abyss-

Header.Navigation Classes

Class NameDescription
.abyss-header-navigation-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

Header.DrawerLink Classes

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

Note: 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