Skip to main content

This is a draft (version 0.5.0). The National Information Technology Agency (NITA) plans to make GGDS official guidance for government websites after independent accessibility testing. What this means

Ghana Government Design System Design system for Government of Ghana websites – home Search

Navigation

Tab links

Links that look like tabs, for moving between views of the same section.

When to use

  • For views of one list, such as "News", "Public notices" and "Publications".
  • For a few pages about one thing, such as a service's "Overview", "Fees" and "How to apply".

When not to use

  • For content that should all be on one page. Use headings.
  • To show and hide parts of one page. GGDS has no in-page tabs; use headings, or a disclosure.
  • As the main navigation. Use the header.
  • For steps of a form.

How to use

  • Each tab is a normal link to its own page or address, such as ?kind=news, so it works without JavaScript and can be bookmarked.
  • Mark the current tab with aria-current="page".
  • Keep to two to five tabs, with names of one to three words.
  • Keep the tabs in the same order and place on every page they appear.
  • On a narrow phone the tabs stay on one line and the row scrolls sideways, so tabs at the end can be out of sight. Short names keep them all in view.
  • Change the page <title> to name the current tab, such as "Public notices – News".

Do

  • Name tabs after what people will find: "Public notices".

Don't

  • Add role="tab" or role="tablist".
  • Use more tabs than fit on a phone.

Accessibility

What GGDS does

  • They are ordinary links, so they work with every assistive technology and without JavaScript.
  • Every tab is at least 44px tall.
  • The current tab is shown by more than colour: it is bold, with a thick line under it.

What you need to do

  • Do not add ARIA tab roles. These are links and should be announced as links; people expect ARIA tabs to switch with arrow keys, without loading a page.
  • Mark the current tab with aria-current="page".
  • Name the navigation, such as aria-label="Kinds of news".
  • Give each tab's page its own title (WCAG 2.4.2).

Example: Tab links

Open this example on its own page

HTML code for “Tab links”
HTML
<nav class="ggds-tab-links" aria-label="Kinds of news">
  <ul class="ggds-tab-links__list">
    <li><a class="ggds-tab-links__link" href="?kind=all" aria-current="page">All</a></li>
    <li><a class="ggds-tab-links__link" href="?kind=news">News</a></li>
    <li><a class="ggds-tab-links__link" href="?kind=notices">Public notices</a></li>
    <li><a class="ggds-tab-links__link" href="?kind=publications">Publications</a></li>
  </ul>
</nav>
JSX (React)
<nav className="ggds-tab-links" aria-label="Kinds of news">
  <ul className="ggds-tab-links__list">
    <li><a className="ggds-tab-links__link" href="?kind=all" aria-current="page">All</a></li>
    <li><a className="ggds-tab-links__link" href="?kind=news">News</a></li>
    <li><a className="ggds-tab-links__link" href="?kind=notices">Public notices</a></li>
    <li><a className="ggds-tab-links__link" href="?kind=publications">Publications</a></li>
  </ul>
</nav>

Use it

Stylesheet
ggds.css includes it. To load only the parts you use: core.css, then components/navigation.css (0.9 KB with gzip, minified), which also holds breadcrumbs, pagination and tab links.
JavaScript
None needed.

HTML

Copy the HTML under each example above. It works in any website.

Astro

No Astro component: copy the HTML.

React and Next.js

No React component: switch the HTML under an example to JSX (React) and copy it.

Django

No template tag: copy the HTML into your template.

Classes and states

Classes for tab links
ClassWhat it does
.ggds-tab-linksThe <nav>, with a line under the tabs.
.ggds-tab-links__listThe tabs. Scrolls sideways when they do not fit.
.ggds-tab-links__linkA tab: a link to its own page.
States of tab links
StateWhat it does
aria-current="page" on .ggds-tab-links__linkThe current tab: bold, with a thick line under it.

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.

Manual accessibility checks for tab links
CheckResultNotes
Keyboard onlyNot tested yetWaiting for the external audit with disabled people (decision D-09).
NVDA screen reader with Firefox or Chrome (Windows)Not tested yetWaiting for the external audit with disabled people (decision D-09).
JAWS screen reader with Chrome (Windows)Not tested yetWaiting for the external audit with disabled people (decision D-09).
VoiceOver screen reader with Safari (iPhone)Not tested yetWaiting for the external audit with disabled people (decision D-09).
TalkBack screen reader with Chrome (Android)Not tested yetWaiting for the external audit with disabled people (decision D-09).
Zoom to 400%, and increased text spacingNot tested yetWaiting for the external audit with disabled people (decision D-09).
Windows contrast themes (forced colours)Not tested yetWaiting for the external audit with disabled people (decision D-09).
Voice control (Voice Access or Dragon)Not tested yetWaiting for the external audit with disabled people (decision D-09).

Changes

Changes to tab links, newest first
VersionChange
0.2.0Fuller guidance for tags, breadcrumbs, disclosures, the skip link, pagination, rich text, tables and tab links.
0.1.0Added.

Every change, in What’s new

Back to top

Something wrong, unclear or missing? Report a problem with this page or suggest a change to it on GitHub. You need a GitHub account.