Skip to main content
U.S. Flag

An official website of the United States government

Healthcare.gov Header

Alert:

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

Loading

Logged-Out

Loading

Minimal

Loading

Code

React

React Properties Documentation
NameTypeDefaultDescription
classNamestring

Additional classes to be added to the root <header> element.

initialLanguageLanguage
switchLocaleLinkstring

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 initialLanguage provided, i.e. if initialLanguage is en, the link's label will always be "Español". This takes precedence over the subpath prop.

loggedInboolean

Indicate that a user is logged-in.

hideLoginLinkboolean

When set to true, do not display the Login text in the upper right of the header

hideLogoutLinkboolean

When set to true, even if logged in the Logout link will not render

hideLanguageSwitchboolean

When set to true, do not display the the switch locale link

firstNamestring

For logged-in users, pass in their first name to display in the header

subpathstring

For applications hosted at paths other than the root healthcare.gov/ cuidadodesalud.gov. This string will be appended to the end of the language links so as to keep the user within the same part of the site when switching languages.

primaryDomainstring

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 (http:// or https://) and the domain only, with no trailing slash. For example, if the provided string is https://test.healthcare.gov, the login link will render as https://test.healthcare.gov/login instead of just /login. Note that this is only really necessary if your application is hosted on a subdomain, such as https://localhelp.healthcare.gov, where relative links would direct the user to the wrong location, e.g. the link to /login would incorrectly direct the user to https://localhelp.healthcare.gov/login when it should direct the user to https://healthcare.gov/login.

skipNavHrefstring'#main'

A URL hash used for the "Skip to main content" link. This is typically the id of your "main" content area (ie. #main).

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).

deConsumerboolean

Indicates when a consumer is coming from a Direct Enrollment flow. This will include additional messaging and modify some of the links.

deBrokerNamestring

Used in conjunction with deConsumer, the Direct Enrollment broker's name is used in some of the messaging displayed to the consumer.

linksLink[]

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 defaultMenuLinks method.

submenuTopReact.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 links prop, e.g. a search input. Will appear above any links provided by the defaultMenuLinks method or the links provided by the links prop.

submenuBottomReact.ReactNode

Same as submenuTop, except it will appear below any links provided by the defaultMenuLinks method or the links provided by the links prop.

headerBottomReact.ReactNode

Element added to display content on Header bottom section

isMenuOpenboolean
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);