This component is only used for HealthCare. Please use the theme switcher to view the component with HealthCare styles.
Examples
The HealthCare.gov header component varies depending on the user's state (ie. logged-in) and context (ie. what page the user is on).
Logged-In
Logged-Out
Minimal
Code
React
Name | Type | Default | Description |
---|---|---|---|
className | string | Additional classes to be added to the root | |
initialLanguage | Language | ||
switchLocaleLink | string | For applications that handle their own locale switching. Overrides the
default locale link. The link's label is still determined by the opposite
of the | |
loggedIn | boolean | Indicate that a user is logged-in. | |
hideLoginLink | boolean | When set to true, do not display the Login text in the upper right of the header | |
hideLogoutLink | boolean | When set to true, even if logged in the Logout link will not render | |
hideLanguageSwitch | boolean | When set to true, do not display the the switch locale link | |
firstName | string | For logged-in users, pass in their first name to display in the header | |
subpath | string | For applications hosted at paths other than the root | |
primaryDomain | string | The primary, or root domain where the majority of header links should be
hosted. By default, links render with relative paths, but providing this
prop will force all links to render with absolute paths based on the
provided string. The string should include the protocol ( | |
skipNavHref | string | '#main' | A URL hash used for the "Skip to main content" link. This is
typically the |
onSkipNavClick | (...args: any[]) => any | An onClick handler used for the "Skip to main content" link. This can be used in cases where one would need to manually set the focus on the content area (e.g. where hash routing is being used). | |
deConsumer | boolean | Indicates when a consumer is coming from a Direct Enrollment flow. This will include additional messaging and modify some of the links. | |
deBrokerName | string | Used in conjunction with | |
links | Link[] | Optionally pass in an array of link objects to override the default
set of menu links. This may be useful if you need to customize the
links on a page-by-page basis. To reference the default set of menu
links, you can import the | |
submenuTop | React.ReactNode | Optionally pass a React component to render within the menu. Useful for
when you need more control over what appears in the menu than what's
provided by the | |
submenuBottom | React.ReactNode | Same as | |
headerBottom | React.ReactNode | Element added to display content on Header bottom section | |
isMenuOpen | boolean | ||
onMenuToggle | () => void |
Google Analytics
Analytics event tracking is enabled by default.
On applications where the page has utag
loaded, the data goes to Tealium which allows it to route to Google Analytics or the currently approved data analytics tools.
Disabling event tracking
Import and set the setHeaderSendsAnalytics
feature flag to false
in your application's entry file:
import { setHeaderSendsAnalytics } from "@cmsgov/<design-system-package>";
setHeaderSendsAnalytics(false);
Component maturity
For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.