Page structure
Header and main navigation
Your institution's logo and name, the main sections and search, at the top of every page.
When to use
- On every page, straight after the banner.
When not to use
- For links within one section. Use tab links or a list on the page instead.
How to use
- Use your approved logo. Until you have one, use your initials in the round badge (
ggds-header__monogram). - If your name is longer than 45 characters, add
ggds-header__name--long. It sets the name smaller on phones. - Mark the section the visitor is in with
aria-current="page". - Point Search at your website's search page.
- Below 1280px wide, the sections move behind a menu button. The menu pushes the page down instead of covering it. Without JavaScript the sections show as a list under the name.
Do
- Keep to six sections or fewer, with short names.
- Name sections after what people do: "Services", "Complaints".
Don't
- Name sections after departments people do not know.
- Add a second row of links to the header.
Accessibility
What GGDS does
- The current section is shown by more than colour: a line beside it on phones and an underline on wide screens.
- The menu pushes the page down instead of covering it, so keyboard users never land on content they cannot see. Escape closes it and returns focus to the menu button.
- The page leaves room under the sticky header, so focused links are never hidden behind it.
- Without JavaScript the sections show as a list, so nothing depends on the script.
What you need to do
- Mark the current section with
aria-current="page". - Give a logo image
alttext naming your institution, or use the initials, which are hidden from screen readers because the name follows. - Keep section names short so the menu stays easy to scan.
Example: Header with main navigation
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="/">
<span class="ggds-header__monogram" aria-hidden="true">EA</span>
<span class="ggds-header__text">
<span class="ggds-header__name">Example Agency</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="/services/" aria-current="page">Services</a></li>
<li><a class="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a class="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a class="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a class="ggds-header__search" href="/search/"><svg class="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg><span class="ggds-header__search-label">Search</span></a>
<button type="button" class="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header><header className="ggds-header">
<div className="ggds-container ggds-header__inner">
<a className="ggds-header__identity" href="/">
<span className="ggds-header__monogram" aria-hidden="true">EA</span>
<span className="ggds-header__text">
<span className="ggds-header__name">Example Agency</span>
<span className="ggds-header__country">Republic of Ghana</span>
<span className="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav className="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul className="ggds-header__list">
<li><a className="ggds-header__link" href="/services/" aria-current="page">Services</a></li>
<li><a className="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a className="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a className="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a className="ggds-header__search" href="/search/"><svg className="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg><span className="ggds-header__search-label">Search</span></a>
<button type="button" className="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg className="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16" /></svg><svg className="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18" /></svg><span className="ggds-visually-hidden">Menu</span></button>
</div>
</header>Example: Header with logo and a long name
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="/">
<img class="ggds-header__logo" src="../../assets/example-logo.svg" alt="" width="44" height="44">
<span class="ggds-header__text">
<span class="ggds-header__name ggds-header__name--long">Ministry of Example Services, Digital Affairs and Innovation</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="/our-agencies/">Agencies</a></li>
<li><a class="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a class="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a class="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a class="ggds-header__search" href="/search/"><svg class="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg><span class="ggds-header__search-label">Search</span></a>
<button type="button" class="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header><header className="ggds-header">
<div className="ggds-container ggds-header__inner">
<a className="ggds-header__identity" href="/">
<img className="ggds-header__logo" src="../../assets/example-logo.svg" alt="" width="44" height="44" />
<span className="ggds-header__text">
<span className="ggds-header__name ggds-header__name--long">Ministry of Example Services, Digital Affairs and Innovation</span>
<span className="ggds-header__country">Republic of Ghana</span>
<span className="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav className="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul className="ggds-header__list">
<li><a className="ggds-header__link" href="/our-agencies/">Agencies</a></li>
<li><a className="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a className="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a className="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a className="ggds-header__search" href="/search/"><svg className="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg><span className="ggds-header__search-label">Search</span></a>
<button type="button" className="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg className="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16" /></svg><svg className="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18" /></svg><span className="ggds-visually-hidden">Menu</span></button>
</div>
</header>Example: Header in an agency theme
<div data-ggds-theme="gdcl">
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="/">
<span class="ggds-header__monogram" aria-hidden="true">EDC</span>
<span class="ggds-header__text">
<span class="ggds-header__name">Example Digital Centres</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="gdcl-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="/services/">Services</a></li>
<li><a class="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a class="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a class="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a class="ggds-header__search" href="/search/"><svg class="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg><span class="ggds-header__search-label">Search</span></a>
<button type="button" class="ggds-header__menu-button" aria-controls="gdcl-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header>
</div><div data-ggds-theme="gdcl">
<header className="ggds-header">
<div className="ggds-container ggds-header__inner">
<a className="ggds-header__identity" href="/">
<span className="ggds-header__monogram" aria-hidden="true">EDC</span>
<span className="ggds-header__text">
<span className="ggds-header__name">Example Digital Centres</span>
<span className="ggds-header__country">Republic of Ghana</span>
<span className="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav className="ggds-header__nav" id="gdcl-nav" aria-label="Main">
<ul className="ggds-header__list">
<li><a className="ggds-header__link" href="/services/">Services</a></li>
<li><a className="ggds-header__link" href="/regulation/">Laws & regulations</a></li>
<li><a className="ggds-header__link" href="/news-notices/">News & notices</a></li>
<li><a className="ggds-header__link" href="/about/">About & contact</a></li>
</ul>
</nav>
<a className="ggds-header__search" href="/search/"><svg className="ggds-header__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg><span className="ggds-header__search-label">Search</span></a>
<button type="button" className="ggds-header__menu-button" aria-controls="gdcl-nav" aria-expanded="false" hidden><svg className="ggds-header__icon ggds-header__icon--menu" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M4 6h16M4 12h16M4 18h16" /></svg><svg className="ggds-header__icon ggds-header__icon--close" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18" /></svg><span className="ggds-visually-hidden">Menu</span></button>
</div>
</header>
</div>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/header.css(1.3 KB with gzip, minified).- JavaScript
- Optional. With the GGDS script, below 80rem the sections go behind a menu button that opens the list in place and closes with Escape, returning focus to the button. Without it, the sections show as a list under the name.
HTML
Copy the HTML under each example above. It works in any website.
Astro
With @ggds/astro:
import Header from '@ggds/astro/Header.astro';
<Header name="National Communications Authority" initials="NCA"
nav={[{ label: 'Services', href: '/services/' }, { label: 'About', href: '/about/' }]}
current={Astro.url.pathname} />React and Next.js
With @ggds/react:
import { Header } from '@ggds/react';
<Header name="Example Agency" initials="EA" current="/services/"
nav={[{ label: 'Services', href: '/services/' }, { label: 'About', href: '/about/' }]} />Django
With ggds-django ({% load ggds %}):
{% ggds_header name="National Communications Authority" initials="NCA" nav=nav %}Classes and states
| Class | What it does |
|---|---|
.ggds-header | The header. Sticky, white, with the flag colours as a thin line above and a line in the institution's colour below. |
.ggds-header__inner | The row inside the page width. |
.ggds-header__identity | The link home: logo or initials, name and country. |
.ggds-header__logo | An approved logo, 44px, drawn round. |
.ggds-header__monogram | The institution's initials in a round badge, until it has an approved logo. |
.ggds-header__text | The name and country. |
.ggds-header__name | The institution's name, in its colour. |
.ggds-header__name--long | A name longer than 45 characters: set smaller on phones. |
.ggds-header__country | "Republic of Ghana" under the name, on wide screens. |
.ggds-header__nav | The main navigation. |
.ggds-header__nav--collapsible | Added by the GGDS script: the navigation can be hidden behind the menu button. |
.ggds-header__list | The list of sections. |
.ggds-header__link | A section link. |
.ggds-header__search | The link to the search page, with its icon. |
.ggds-header__search-label | The word "Search": shown on wide screens, otherwise kept for screen readers only. |
.ggds-header__menu-button | The menu button. Has hidden until the GGDS script shows it. |
.ggds-header__icon | An icon in the header. |
.ggds-header__icon--menu | The menu icon, shown while the menu is closed. |
.ggds-header__icon--close | The close icon, shown while the menu is open. |
| State | What it does |
|---|---|
aria-current="page" on .ggds-header__link | The section the visitor is in: marked with a line in the link colour, and underlined on wide screens. |
aria-expanded="true" on .ggds-header__menu-button | The menu is open: the close icon shows. |
hidden on .ggds-header__nav | The menu is closed (set by the GGDS script). |
Accessibility tests
Automated, on every change
These run each time GGDS changes. A change that fails one is not accepted.
- WCAG 2.2 A and AA rules (axe), at desktop and phone widths, on every example
- No sideways scrolling on a 320px screen, also with a wide font, on every example
- Every approved colour pair meets its contrast minimum, for every institution theme
- No inline scripts or styles, so it runs under a strict Content Security Policy
- Behaviour test: “opens in place, closes with Escape and returns focus”
- Behaviour test: “navigation is visible and the menu button is not”
- Behaviour test: “one row from 80rem: name, navigation and Search side by side”
- Behaviour test: “a menu button below 80rem”
- Behaviour test: “the header row fits inside the page at 1280px and 1440px, even with six sections”
By people, with assistive technology
Automated tests find only some of the barriers people meet. These checks are still to be done.
| Check | Result | Notes |
|---|---|---|
| Keyboard only | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| NVDA screen reader with Firefox or Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| JAWS screen reader with Chrome (Windows) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| VoiceOver screen reader with Safari (iPhone) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| TalkBack screen reader with Chrome (Android) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Zoom to 400%, and increased text spacing | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Windows contrast themes (forced colours) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
| Voice control (Voice Access or Dragon) | Not tested yet | Waiting for the external audit with disabled people (decision D-09). |
Changes
| Version | Change |
|---|---|
| 0.1.0 | Header, hero, footer and cards share one design: one-row header with the flag-colour line, woven flag band in the footer, institution cards with a line in each institution's colour. |
| 0.1.0 | The phone menu pushes the page down instead of covering it, so keyboard users never land on content they cannot see. |
| 0.1.0 | New: @ggds/astro, the page parts as Astro components (skip link, banner, header, hero, footer, tab bar). |
| 0.1.0 | New: ggds-django, for Django and Django-based CMSs such as Wagtail: the page parts as template tags, a form renderer that turns any Django form into GGDS markup with an error summary and accessible errors, and the GGDS styles, themes and script as static files. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.