Banner
The banner identifies official websites of government organizations in the United States. It also displays an expandable section that helps users understand how to identify official .gov sites and secure HTTPS connections.
Default Banner
Component Preview
Component Code
Expanded Banner
Component Preview
Component Code
Guidance
When to use the banner component
- Use the banner on all government websites to help establish trust and communicate the official nature of the site to users.
- The banner helps users identify that the website they're visiting is an official government website, which is especially important for sensitive transactions or information sharing.
When to consider something else
- Non-government websites.
- The banner is specifically designed for U.S. government websites. Do not use it on non-government sites, as this would be misleading to users.
- Sites that don't use .gov or .mil domains.
- If your site doesn't use a .gov or .mil domain, the banner content about official websites may not apply. Consider whether using the banner is appropriate for your situation.
Usability guidance
- Place the banner at the very top of the page.
- The banner should appear above all other content, including the site header. This ensures users see it first when visiting the site.
- Don't modify the banner content.
- The language in the banner has been carefully crafted and tested. Avoid changing the text, as modifications may reduce the banner's effectiveness in building user trust.
- Keep the banner collapsed by default.
- The expanded content should only be shown when users click "Here's how you know." This keeps the banner compact and non-intrusive while still providing additional information for users who want it.
- Use the appropriate banner language for your audience.
- USWDS provides both English and Spanish versions of the banner. Use the language that best serves your site's primary audience.
Accessibility guidance
- Use proper heading levels.
- Ensure the banner's heading structure fits within your page's overall heading hierarchy. The banner uses semantic HTML that supports screen readers.
- Ensure keyboard accessibility for expand/collapse.
- Users must be able to expand and collapse the banner content using only a keyboard. The button should be focusable and respond to Enter and Space key presses.
- Use appropriate ARIA attributes.
- The banner button uses
aria-expandedto indicate the current state andaria-controlsto associate the button with the expandable content region. - Provide meaningful alt text for icons.
- Decorative icons like the flag should use
aria-hidden="true"and empty alt text. The lock icon includes a title element for screen reader users.
USWDS Documentation
For more guidance, view the USWDS Banner Component Documentation.
Settings
| Variable | Description |
|---|---|
$theme-banner-background-color
|
Background color of the banner. |
$theme-banner-font-family
|
Font family of the banner text. |
$theme-banner-link-color
|
Color of links in the banner. |
$theme-banner-max-width
|
Maximum width of the banner content area. |
Variants
| Variant | Description |
|---|---|
|
|
The default banner component with expand/collapse functionality. |
|
|
Shows the banner in its expanded state, revealing the "Here's how you know" content. |
|
|
Spanish language variant of the banner with translated content. |