Header (header)

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

🔗 External documentation.

ID Label Description Schema
top Top Expect a logo component
nav Nav Expect a nav component
close_icon Close icon path Path to close icon.
                        type: string

                      
            id: header
label: Header
description: 'Helps users identify where they are and provides a quick, organized way to reach the main sections of a website.'
group: Layout
homepage: 'https://designsystem.digital.gov/components/header/'
variants:
    basic:
        id: basic
        label: Basic
        description: 'Orient users to a simple site.'
    extended:
        id: extended
        label: 'Extended (Default)'
        description: 'Orient users to a site with lots of sections.'
slots:
    top:
        id: top
        label: Top
        description: 'Expect a logo component'
    nav:
        id: nav
        label: Nav
        description: 'Expect a nav component'
props:
    close_icon:
        id: close_icon
        label: 'Close icon path'
        description: 'Path to close icon.'
        schema:
            type: string
examples:
    preview:
        id: preview
        label: Preview
        renderable:
            '@component': header
            top:
                '@component': logo
                site_name: 'Project title'
            nav:
                '@component': nav
                search:
                    '@component': search
                    search_id: test-search-field
                primary:
                    -
                        title: 'Current section'
                        url: 'https://example.com'
                        is_expanded: true
                        in_active_trail: true
                        below:
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                                in_active_trail: true
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                            -
                                title: 'A very long navigation link that goes onto two lines'
                                url: 'https://example.com'
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                    -
                        title: Home
                        url: 'https://example.com'
                        below:
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                                in_active_trail: true
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                            -
                                title: '2nd level link'
                                url: 'https://example.com'
                secondary:
                    -
                        title: Data
                        url: 'https://example.com'
                    -
                        title: 'Secondary link'
                        url: 'https://example.com'
                    -
                        title: 'Another secondary link'
                        url: 'https://example.com'
            close_icon: 'https://cdn.jsdelivr.net/npm/@uswds/uswds@3.7.0/dist/img/usa-icons/close.svg'

          

Basic ( basic )

Orient users to a simple site.

<header class="usa-header usa-header--basic" role="banner"> <div class="usa-logo site-logo" id="logo"> <em class="usa-logo__text"> <a href="" accesskey="2" title="Home" aria-label="Home">Project title</a> </em> </div> <div class="usa-nav-container"> <nav class="usa-nav" role="navigation"> <div class="usa-nav__inner"> <button type="button" class="usa-nav__close"> <img src="usa-icons/close.svg" alt="Close" /> </button> <ul class="usa-nav__primary usa-accordion"> <li class="usa-nav__primary-item"> <a class="usa-nav__link usa-current" href="https://example.com"> <span>Current section</span> </a> </li> <li class="usa-nav__primary-item"> <a class="usa-nav__link" href="https://example.com"> <span>Home</span> </a> </li> </ul> <div class="usa-nav__secondary"> <ul class="usa-nav__secondary-links"> <li class="usa-nav__secondary-item"> <a href="https://example.com">Data</a> </li> <li class="usa-nav__secondary-item"> <a href="https://example.com">Secondary link</a> </li> <li class="usa-nav__secondary-item"> <a href="https://example.com">Another secondary link</a> </li> </ul> <section aria-label="Search component"> <form class="usa-search"> <div role="search"> <!-- [Error] component: label, template not found: label --> <input class="usa-input" id="test-search-field" type="search" name="search" /> <button class="usa-button" type="submit"> <span class="usa-search__submit-text">Search</span> <img src="" class="usa-search__submit-icon" alt="Search"> </button> </div> </form> </section> </div> </div> </nav></div> </header>

Extended (Default) ( extended )

Orient users to a site with lots of sections.

<header class="usa-header usa-header--extended" role="banner"> <div class="usa-logo site-logo" id="logo"> <em class="usa-logo__text"> <a href="" accesskey="2" title="Home" aria-label="Home">Project title</a> </em> </div> <nav class="usa-nav" role="navigation"> <div class="usa-nav__inner"> <button type="button" class="usa-nav__close"> <img src="usa-icons/close.svg" alt="Close" /> </button> <ul class="usa-nav__primary usa-accordion"> <li class="usa-nav__primary-item"> <a class="usa-nav__link usa-current" href="https://example.com"> <span>Current section</span> </a> </li> <li class="usa-nav__primary-item"> <a class="usa-nav__link" href="https://example.com"> <span>Home</span> </a> </li> </ul> <div class="usa-nav__secondary"> <ul class="usa-nav__secondary-links"> <li class="usa-nav__secondary-item"> <a href="https://example.com">Data</a> </li> <li class="usa-nav__secondary-item"> <a href="https://example.com">Secondary link</a> </li> <li class="usa-nav__secondary-item"> <a href="https://example.com">Another secondary link</a> </li> </ul> <section aria-label="Search component"> <form class="usa-search"> <div role="search"> <!-- [Error] component: label, template not found: label --> <input class="usa-input" id="test-search-field" type="search" name="search" /> <button class="usa-button" type="submit"> <span class="usa-search__submit-text">Search</span> <img src="" class="usa-search__submit-icon" alt="Search"> </button> </div> </form> </section> </div> </div> </nav> </header>