Components

Header

A header helps users identify where they are and provides a quick, organized way to reach the main sections of a website.

When to use a header component

  • Use the gov banner on all federal websites. We recommend that all federal government websites include the “official government website” banner and a logo or site name.
  • Most websites require header navigation. Most websites require some form of navigation to help users find the information they need. While a horizontal navigation bar is just one option for navigation design, it is one of the most visible and familiar ways of helping users navigate a site.

Header usability

  • List all important website sections as links in the horizontal navigation.
  • Dropdown menus help preview lower-level content. For large websites, use dropdown menus to help users preview lower-level content. If lower-level sections are closely related and users will need to quickly jump between them, consider using a side navigation instead of — or in addition to — a dropdown.
  • Use short, clear link labels. Don’t use jargon or unfamiliar terms.
  • Left-justify. Left-justified link labels are more easily scannable.
  • Present links in priority order. Higher-demand links should appear farther to the left, and lower-demand links should appear farther to the right.
  • Avoid org-structure navigation. Don’t model your navigation after your agency’s org structure. Instead, structure it according to the tasks and information your users most frequently need to access.
  • Highlight the current section. Show users where they are within the site by highlighting the current section.
  • Always research your navigation. Conduct research with your users, and base decisions about your site’s information architecture and navigation structure on your findings. Continue researching to confirm that updates meet your users’ needs.

Header accessibility

  • Include skip navigation links to allow users with screen readers to bypass long navigation lists. Make sure you include an id at the beginning of your main content and that it matches the skipnav link. Find more information on these links at WebAIM.
  • Include tab focus for all top-level navigation navigation items — this feature will allow keyboard-reliant users to easily navigate interactive items.
  • Ensure your horizontal navigation is keyboard compatible; test to make sure users can use Tab to navigate and Space (or Enter) to open pages.
  • Avoid using hover to expand dropdown lists. Hover is difficult for some users and won't work on touch screens. Dropdowns should expand on click or with keyboard navigation.
  • The Design System uses semantic header and nav elements with role="banner" and role="navigation" respectively. role="banner" is your masthead.
  • You can use multiple nav elements for groups of navigation links, but you should only use one role="navigation" for the main nav of a page.
  • Use lists for your nav links — doing so enables screen readers to decipher header contents.
  • If you’re using a logo that’s an image rather than text, make sure you include alternative text for screen readers.
  • If you’re using a logo that’s text, use an em, not an h1, unless it’s the homepage. Find more information here: http://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/.

The “official government website” banner

We recommend that all federal government websites include the “official government website” banner and a logo or site name. The banner clearly identifies your website as part of the United States government, while a logo or site name helps visitors understand who you are and what you do.

Building with HTTPS

HTTPS is a best practice for all websites: It’s secure, private, and fast, and search engines prefer encrypted sites. But it’s especially important for government websites. The .gov in government websites carries a lot of weight. The public expects the contents of .gov websites to be official and accurate, and they expect any information they submit to that website to be private. The U.S. CIO provides guidance to implementing HTTPS for government websites at https://https.cio.gov/.

Further reading

Implementation

Header settings

Variable Description
$theme-header-font-family

Font family of the header.

$theme-header-logo-text-width

Width of the logo text area at desktop width as a percentage of the total header width.

$theme-header-max-width

Maximum width of the header.

$theme-header-min-width

Breakpoint at which the non-mobile header is shown.

Basic header

Orient users to a simple site.

<div class="usa-overlay"></div>
<header class="usa-header usa-header--basic">
  <div class="usa-nav-container">
    <div class="usa-navbar">
      <div class="usa-logo" id="-logo">
        <em class="usa-logo__text"><a href="/" title="Home">Home</a></em>
      </div>
      <button class="usa-menu-btn">Menu</button>
    </div>
    <nav aria-label="Primary navigation" class="usa-nav">
      <button class="usa-nav__close">
        <img src="/assets/img/usa-icons/close.svg" role="img" alt="Close" />
      </button>
      <ul class="usa-nav__primary usa-accordion">
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link usa-current"
            aria-expanded="false"
            aria-controls="basic-nav-section-one"
          >
            <span>&lt;Current section&gt;</span>
          </button>
          <ul id="basic-nav-section-one" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link"
            aria-expanded="false"
            aria-controls="basic-nav-section-two"
          >
            <span>&lt;Section&gt;</span>
          </button>
          <ul id="basic-nav-section-two" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <a href="" class="usa-nav-link"><span>&lt;Simple link&gt;</span></a>
        </li>
      </ul>
      <section aria-label="Search component">
        <form class="usa-search usa-search--small" role="search">
          <label class="usa-sr-only" for="search-field">Search</label>
          <input
            class="usa-input"
            id="search-field"
            type="search"
            name="search"
          />
          <button class="usa-button" type="submit">
            <img
              src="/assets/img/usa-icons-bg/search--white.svg"
              class="usa-search__submit-icon"
              alt="Search"
            />
          </button>
        </form>
      </section>
    </nav>
  </div>
</header>

Guidance

About

  • Use the basic header if you have few enough sections in your main navigation to fit comfortably next to your logo; this decision will depend on the length of your text and whether you include a search bar. You can customize the header (depending on your site structure) and use it with:
    • A text or image logo
    • With or without dropdown menus
    • With or without a search bar
    • With or without call-to-action buttons in place of the search bar

When to use the basic header

  • Limited sections. The basic header is great if you have a modest number of sections in your main navigation.
  • Shallow hierarchy. You may also use it if each main section listed in the horizontal navigation has six or fewer subsections that you’d like to include in a dropdown menu.

When to consider something else

  • Many sections or deep hierarchy. Consider using the extended header if you have more sections in your horizontal navigation than will fit comfortably next to your logo or if you have complex sections that require the use of a megamenu.

Using the basic header

Package

  • Package usage: @forward "usa-header";
  • Dependencies: uswds-fonts, uswds-helpers, usa-skipnav, usa-search, usa-button, usa-nav, usa-accordion

Basic header with megamenu

Orient users to a site with deeper hierarchical needs.

<div class="usa-overlay"></div>
<header class="usa-header usa-header--basic usa-header--megamenu">
  <div class="usa-nav-container">
    <div class="usa-navbar">
      <div class="usa-logo" id="-logo">
        <em class="usa-logo__text"><a href="/" title="Home">Home</a></em>
      </div>
      <button class="usa-menu-btn">Menu</button>
    </div>
    <nav aria-label="Primary navigation" class="usa-nav">
      <button class="usa-nav__close">
        <img src="/assets/img/usa-icons/close.svg" role="img" alt="Close" />
      </button>
      <ul class="usa-nav__primary usa-accordion">
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link usa-current"
            aria-expanded="false"
            aria-controls="basic-mega-nav-section-one"
          >
            <span>&lt;Current section&gt;</span>
          </button>
          <ul id="basic-mega-nav-section-one" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""
                ><span
                  >&lt;A very long navigation link that goes onto two
                  lines&gt;</span
                ></a
              >
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link"
            aria-expanded="false"
            aria-controls="basic-mega-nav-section-two"
          >
            <span>&lt;Section&gt;</span>
          </button>
          <ul id="basic-mega-nav-section-two" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""
                ><span
                  >&lt;A very long navigation link that goes onto two
                  lines&gt;</span
                ></a
              >
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <a href="" class="usa-nav-link"><span>&lt;Simple link&gt;</span></a>
        </li>
      </ul>
      <section aria-label="Search component">
        <form class="usa-search usa-search--small" role="search">
          <label class="usa-sr-only" for="search-field">Search</label>
          <input
            class="usa-input"
            id="search-field"
            type="search"
            name="search"
          />
          <button class="usa-button" type="submit">
            <img
              src="/assets/img/usa-icons-bg/search--white.svg"
              class="usa-search__submit-icon"
              alt="Search"
            />
          </button>
        </form>
      </section>
    </nav>
  </div>
</header>

Guidance

About

The basic header with a megamenu is similar in design to the basic header component. The megamenu allows for the inclusion of more links in dropdown menus. You can customize this header (depending on your site structure) and use it with:

  • A text or image logo
  • With or without a search bar
  • With or without call-to-action buttons in place of the search bar

When to use the basic header with megamenu

  • Deep hierarchy. Use the basic header with a megamenu if you’d like to include more than six links in any of your dropdown menus and if you have few enough main sections to allow your horizontal navigation to fit comfortably in the basic header.

When to consider something else

  • Not enough content to warrant a megamenu. Consider using a basic dropdown, rather than a megamenu, unless you need to link to a large number of sub-pages.

Using the basic header with megamenu

Package

  • Package usage: @forward "usa-header";
  • Dependencies: uswds-fonts, uswds-helpers, usa-skipnav, usa-search, usa-button, usa-nav, usa-accordion

Extended header

Orient users to a site with lots of sections.

<div class="usa-overlay"></div>
<header class="usa-header usa-header--extended">
  <div class="usa-navbar">
    <div class="usa-logo" id="-logo">
      <em class="usa-logo__text"><a href="/" title="Home">Home</a></em>
    </div>
    <button class="usa-menu-btn">Menu</button>
  </div>
  <nav aria-label="Primary navigation" class="usa-nav">
    <div class="usa-nav__inner">
      <button class="usa-nav__close">
        <img src="/assets/img/usa-icons/close.svg" role="img" alt="Close" />
      </button>
      <ul class="usa-nav__primary usa-accordion">
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link usa-current"
            aria-expanded="false"
            aria-controls="extended-nav-section-one"
          >
            <span>&lt;Current section&gt;</span>
          </button>
          <ul id="extended-nav-section-one" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link"
            aria-expanded="false"
            aria-controls="extended-nav-section-two"
          >
            <span>&lt;Section&gt;</span>
          </button>
          <ul id="extended-nav-section-two" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <a href="" class="usa-nav-link"><span>&lt;Simple link&gt;</span></a>
        </li>
      </ul>
      <div class="usa-nav__secondary usa-header--extended">
        <ul class="usa-nav__secondary-links"></ul>
        <section aria-label="Search component">
          <form class="usa-search usa-search--small" role="search">
            <label class="usa-sr-only" for="search-field">Search</label>
            <input
              class="usa-input"
              id="search-field"
              type="search"
              name="search"
            />
            <button class="usa-button" type="submit">
              <img
                src="/assets/img/usa-icons-bg/search--white.svg"
                class="usa-search__submit-icon"
                alt="Search"
              />
            </button>
          </form>
        </section>
      </div>
    </div>
  </nav>
</header>

Guidance

About

An extended header allows for the inclusion of more sections in a horizontal navigation. You can customize the header (depending on your site structure) and use it:

  • With a text or image logo
  • With or without dropdown menus
  • With or without the expandable search bar
  • With or without call-to-action buttons in place of the secondary links featured in your horizontal navigation

When to use the extended header

  • Lots of sections. Use the extended header if you have too many sections in your horizontal navigation to fit comfortably in the basic header format.
  • Secondary links or specific calls to action. Use the extended header if you’d like to include secondary links or specific calls to action in addition to the main content navigation — for example Log in and Sign up links.

When to consider something else

  • Simple site needs. Consider using the basic header if you have less information — the basic header takes up less space.

Using the extended header

Package

  • Package usage: @forward "usa-header";
  • Dependencies: uswds-fonts, uswds-helpers, usa-skipnav, usa-search, usa-button, usa-nav, usa-accordion

Extended header with megamenu

Orient users to a site with lots of sections and deeper hierarchical needs.

<div class="usa-overlay"></div>
<header class="usa-header usa-header--extended">
  <div class="usa-navbar">
    <div class="usa-logo" id="-logo">
      <em class="usa-logo__text"><a href="/" title="Home">Home</a></em>
    </div>
    <button class="usa-menu-btn">Menu</button>
  </div>
  <nav aria-label="Primary navigation" class="usa-nav">
    <div class="usa-nav__inner">
      <button class="usa-nav__close">
        <img src="/assets/img/usa-icons/close.svg" role="img" alt="Close" />
      </button>
      <ul class="usa-nav__primary usa-accordion">
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link usa-current"
            aria-expanded="false"
            aria-controls="extended-mega-nav-section-one"
          >
            <span>&lt;Current section&gt;</span>
          </button>
          <ul id="extended-mega-nav-section-one" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""
                ><span
                  >&lt;A very long navigation link that goes onto two
                  lines&gt;</span
                ></a
              >
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <button
            class="usa-accordion__button usa-nav__link"
            aria-expanded="false"
            aria-controls="extended-mega-nav-section-two"
          >
            <span>&lt;Section&gt;</span>
          </button>
          <ul id="extended-mega-nav-section-two" class="usa-nav__submenu">
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""
                ><span
                  >&lt;A very long navigation link that goes onto two
                  lines&gt;</span
                ></a
              >
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
            <li class="usa-nav__submenu-item">
              <a href=""><span>&lt;Navigation link&gt;</span></a>
            </li>
          </ul>
        </li>
        <li class="usa-nav__primary-item">
          <a href="" class="usa-nav-link"><span>&lt;Simple link&gt;</span></a>
        </li>
      </ul>
      <div class="usa-nav__secondary usa-header--extended">
        <ul class="usa-nav__secondary-links"></ul>
        <section aria-label="Search component">
          <form class="usa-search usa-search--small" role="search">
            <label class="usa-sr-only" for="search-field">Search</label>
            <input
              class="usa-input"
              id="search-field"
              type="search"
              name="search"
            />
            <button class="usa-button" type="submit">
              <img
                src="/assets/img/usa-icons-bg/search--white.svg"
                class="usa-search__submit-icon"
                alt="Search"
              />
            </button>
          </form>
        </section>
      </div>
    </div>
  </nav>
</header>

Guidance

About

Like an extended header, an extended header with a megamenu allows for the inclusion of more sections in your horizontal navigation; it also allows you to include more links in your dropdowns. You can customize the header (depending on your site structure) and use it:

  • With a text or image logo
  • With or without the expandable search bar
  • With or without call-to-action buttons in place of the secondary links in the horizontal navigation

When to use the extended header with megamenu

  • Lots of sections. Use an extended header with a mega menu if you have too many sections in your horizontal navigation to fit comfortably in the basic header format.
  • Secondary links or specific calls to action. This type of header is also useful if you’d like to include secondary links or specific calls to action in addition to the main content navigation — for example Log in and Sign up links.
  • Deep hierarchy. Use this type of header if you’d like to include more than six links in any of your dropdowns.

When to consider something else

  • Shallow hierarchy. Consider using a basic dropdown, rather than a megamenu, unless you need to link to a very large number of sub-pages.

Using the extended header with megamenu

Package

  • Package usage: @forward "usa-header";
  • Dependencies: uswds-fonts, uswds-helpers, usa-skipnav, usa-search, usa-button, usa-nav, usa-accordion