Page structure
Tab bar
Home, up to three main sections and Search, fixed to the bottom of the screen on phones.
When to use
- On every page, together with the header. It only shows on phones.
When not to use
- On wider screens: it hides itself there, and the header shows the sections.
- For more than five links.
How to use
- Always start with Home and end with Search.
- Choose the three sections people use most. If unsure, the first three of: Agencies, Services, Complaints, Laws, Data, News, About.
- Put it after the footer. The footer then leaves room so nothing is hidden behind the tab bar.
Do
- Use the same tabs on every page.
Don't
- Use icons without labels.
Accessibility
What GGDS does
- Every tab has a visible label as well as its icon, and the icons are hidden from screen readers.
- Each tab is at least 44px tall.
- The footer leaves room, so nothing is hidden behind the bar.
- It is a separate navigation area with its own name, so screen reader users can tell it from the header.
What you need to do
- Mark the section the visitor is in with
aria-current="page". - Use the same tabs on every page.
Example: Phone tab bar (narrow screens only)
<p>On a phone, the tab bar is fixed to the bottom of this frame. From 48rem it is hidden: the header shows the navigation.</p>
<nav class="ggds-tab-bar" aria-label="Quick links">
<ul class="ggds-tab-bar__list">
<li><a class="ggds-tab-bar__link" href="/" aria-current="page"><svg class="ggds-tab-bar__icon" 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="M3 11.5 12 4l9 7.5"/><path d="M5.5 9.5V20h13V9.5"/></svg><span>Home</span></a></li>
<li><a class="ggds-tab-bar__link" href="/services/"><svg class="ggds-tab-bar__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="4" y="4" width="16" height="16" rx="2"/><path d="M8 9h8M8 13h8M8 17h5"/></svg><span>Services</span></a></li>
<li><a class="ggds-tab-bar__link" href="/consumer-help/complaints/"><svg class="ggds-tab-bar__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="12" cy="12" r="8.5"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6V14"/><path d="M12 17h.01"/></svg><span>Complaints</span></a></li>
<li><a class="ggds-tab-bar__link" href="/regulation/"><svg class="ggds-tab-bar__icon" 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="M12 4v16M7 20h10M5 8h14"/><path d="m5 8-2.5 6a2.5 2.5 0 0 0 5 0z"/><path d="m19 8-2.5 6a2.5 2.5 0 0 0 5 0z"/></svg><span>Laws</span></a></li>
<li><a class="ggds-tab-bar__link" href="/search/"><svg class="ggds-tab-bar__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>Search</span></a></li>
</ul>
</nav><>
<p>On a phone, the tab bar is fixed to the bottom of this frame. From 48rem it is hidden: the header shows the navigation.</p>
<nav className="ggds-tab-bar" aria-label="Quick links">
<ul className="ggds-tab-bar__list">
<li><a className="ggds-tab-bar__link" href="/" aria-current="page"><svg className="ggds-tab-bar__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M3 11.5 12 4l9 7.5" /><path d="M5.5 9.5V20h13V9.5" /></svg><span>Home</span></a></li>
<li><a className="ggds-tab-bar__link" href="/services/"><svg className="ggds-tab-bar__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><rect x="4" y="4" width="16" height="16" rx="2" /><path d="M8 9h8M8 13h8M8 17h5" /></svg><span>Services</span></a></li>
<li><a className="ggds-tab-bar__link" href="/consumer-help/complaints/"><svg className="ggds-tab-bar__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="8.5" /><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6V14" /><path d="M12 17h.01" /></svg><span>Complaints</span></a></li>
<li><a className="ggds-tab-bar__link" href="/regulation/"><svg className="ggds-tab-bar__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M12 4v16M7 20h10M5 8h14" /><path d="m5 8-2.5 6a2.5 2.5 0 0 0 5 0z" /><path d="m19 8-2.5 6a2.5 2.5 0 0 0 5 0z" /></svg><span>Laws</span></a></li>
<li><a className="ggds-tab-bar__link" href="/search/"><svg className="ggds-tab-bar__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>Search</span></a></li>
</ul>
</nav>
</>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/tab-bar.css(0.5 KB with gzip, minified).- JavaScript
- None needed.
HTML
Copy the HTML under each example above. It works in any website.
Astro
With @ggds/astro:
import TabBar from '@ggds/astro/TabBar.astro';
<TabBar tabs={[
{ label: 'Home', href: '/', icon: 'home' },
{ label: 'Services', href: '/services/', icon: 'services' },
{ label: 'Search', href: '/search/', icon: 'search' },
]} />React and Next.js
With @ggds/react:
import { TabBar } from '@ggds/react';
<TabBar tabs={[
{ label: 'Home', href: '/', icon: 'home', current: true },
{ label: 'Services', href: '/services/', icon: 'services' },
{ label: 'Search', href: '/search/', icon: 'search' },
]} />Django
With ggds-django ({% load ggds %}):
{% ggds_tab_bar tabs %}Classes and states
| Class | What it does |
|---|---|
.ggds-tab-bar | The bar, fixed to the bottom of phone screens; hidden from 48rem and when printing. A <nav> with its own name. |
.ggds-tab-bar__list | The list of tabs. |
.ggds-tab-bar__link | A tab: icon above its label, at least 44px tall. |
.ggds-tab-bar__icon | A tab's icon, hidden from screen readers. |
| State | What it does |
|---|---|
aria-current="page" on .ggds-tab-bar__link | The section the visitor is in. |
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
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.4.0 | New: page template components: Page in React and Astro, and ggds/page.html in Django ({% extends "ggds/page.html" %}, with your details in GGDS_SITE and ggds_django.context_processors.site). They put the skip link, banner, header, <main id="main">, footer and tab bar in GGDS's order, so a newer GGDS updates the whole frame of a page. React's is a server component; only the header runs in the browser. Django's {% ggds_tab_bar %} takes current= to mark a tab, as the header already did. |
| 0.3.0 | Tab bar: labels are 12px instead of 11.2px, easier to read on a phone. |
| 0.1.0 | New: tab bar, for quick links on phones. |
| 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.