Header

DraftAccessible

The Header component is located at the top of the page above the main body content. It provides a place for levels of primary navigation and site-wide actions.

A work in progress!
The Header components are a collection of new navigation components the HDS team is currently fine tuning. This means that these components are subject to change. We are open to feedback regarding how they work.

Code

Code examples

With all the components

Press Enter to start editing. Press Esc to stop editing.

Note: Header is designed to be used full width at the top of the page above the main content. Preview here might not scale correctly and mobile navigation menu is disabled. View full header example in Storybook.

The Header.Link component has the as prop which you can use to use your own navigation link instead of our Header.Link, which uses HDS Link underneath. You can pass it as an element as={<CustomLink />} or as a component as={CustomLink}.

Press Enter to start editing. Press Esc to stop editing.

Note: Header is designed to be used full width at the top of the page above the main content. Preview here might not scale correctly and mobile navigation menu is disabled. View full header example in Storybook.

Dark theme

Press Enter to start editing. Press Esc to stop editing.

Note: Header is designed to be used full width at the top of the page above the main content. Preview here might not scale correctly and mobile navigation menu is disabled. View full header with dark theme example in Storybook by changing the theme property..

Packages

PackageIncludedStorybook linkSource link
HDS React
Yes
View in StorybookView source
HDS Core
No
--

Properties

Table 1: Header properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing header.string-
classNameAdditional class names to apply.string-
idId for the element.string-
themeHeader theme.light,dark, HeaderCustomThemelight
Table 2: Header.SkipLink properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing SkipLink in more detail.string-
labelLabel for the SkipLink.string-
skipToId of the element where the SkipLink jumps to.string-
themeCustom styling for SkipLink.SkipLinkTheme-
Table 3: Header.UniversalBar properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing UniversalBar.string-
classNameAdditional class names to apply.string-
idID for the UniversalBar element.string-
primaryLinkHrefHypertext reference for the primary link.string-
primaryLinkTextLink text for the primary linkstring-
roleARIA role to describe the contents.string-
Table 4: Header.ActionBar properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing ActionBar.string-
classNameAdditional class names to apply.string-
frontPageLabelLabel for front page link in mobile navigation menu.string-
logoAriaLabelAria-label for the logo.string-
logoHrefURL for the logo.string-
logoLogo component.Logo-
menuButtonAriaLabelAria-label for the menu button.string-
onLogoClickCallback function for when the logo is clicked.MouseEventHandler-
onMenuClickCallback function for when the menu button is clicked.MouseEventHandler-
onTitleClickCallback function for when the title is clicked.MouseEventHandler-
openFrontPageLinksAriaLabelAria-label for describing going back to main navigation links in mobile navigation menu.string-
titleService name.string-
titleAriaLabelAria-label for the title.string-
titleStyleStyle for the service name.TitleStyleType.Normal TitleStyleType.BoldNormal
titleHrefURL for the title.string-
roleARIA role to describe the contents.string-
Table 5: Header.ActionBarItem properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing the item.string-
closeIconIcon for the item when dropdown is open.ReactNode-
closeLabelLabel for the item when dropdown is open.string JSX.Element-
dropdownClassNameAdditional class name for the dropdown element.string-
fixedRightPositionBoolean to set the item in a fixed position on the right side of the action bar behind a dividing line.booleanfalse
fullwidthBoolean to set the item to be fullwidth under the ActionBar. Example use is automatically done with LanguageSelector in mobile view.booleanfalse
iconIcon for the item.ReactNode-
iconClassNameAdditional class name for the icon.string-
idID for the ActionBarItem.string-
labelLabel for the item.string JSX.Element-
labelOnRightBoolean to set the label to the right side of the icon.booleanfalse
preventButtonResizeIf true, menu button resizing is prevented by rendering button's active state to a separate element.booleanfalse
Table 6: Header.LanguageSelector properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing the dropdown button.string-
languageHeadingHeading for the list of languages inside the dropdown.string-
sortLanguageOptionsFunction for sorting language options into primary and secondary. By default, all primary LanguageOptions as shown. If a secondary LanguageOption is selected, only that one is shown.(options: LanguageOption[], selectedLanguage: string) => [LanguageOption[], LanguageOption[]]-
Table 7: Header.SimpleLanguageOptions properties
PropertyDescriptionValuesDefault value
languagesArray of languages to render.[LanguageOption]-
Table 8: Header.Search properties
PropertyDescriptionValuesDefault value
labelLabel for the search input.string JSX.Element-
onChangeCallback function for the input value changes.(inputValue: string) => void-
onSubmitCallback function for when input is submitted.(inputValue: string) => void-
Table 9: Header.NavigationMenu properties
PropertyDescriptionValuesDefault value
ariaLabelAria-label for describing NavigationMenu.string-
idID for the NavigationMenu.string-
Table 9: Header.Link properties
PropertyDescriptionValuesDefault value
activeSet the link as the current page, giving it proper styles.boolean-
asElement or component to use instead of Header.Link.ElementLink
classNameAdditional classNames to apply to the link.string-
closeDropdownAriaButtonLabelAria-label for the dropdown button to describe the closing of the dropdown.string-
dropdownButtonClassNameAdditional classNames to apply to the dropdown button.string-
dropdownClassNameAdditional classNames to apply to the dropdown menu.string-
dropdownLinkClassNameAdditional classNames to apply to the dropdown links.string-
dropdownLinksArray of NavigationLink components to render in a dropdown.[<Header.Link>]-
hrefHypertext Reference of the link.string-
labelLabel for the link.string-
onDropdownButtonClickCallback fired when the dropdown button is clicked.function-
openDropdownAriaButtonLabelAria-label for the dropdown button to describe the opening of the dropdown.string-
wrapperClassNameAdditional classNames for the element wrapping the link.string-