Content
Tag
A short label that shows a status, such as "Open" or "Closed".
When to use
- To show the status of an item in a list or on a page: a licence, a consultation, an application.
- When people need to scan many items and pick out the ones in a certain state.
When not to use
- As a link, button or filter. Tags have no hover or focus style, so people will not know they can press them.
- For a message people must read or act on. Use a notice.
- For categories or keywords. Write them as plain text or links.
How to use
- Use one to three words, such as "In force" or "Closing soon".
- Choose the style by meaning:
ggds-tag--successfor a good or settled state ("Approved", "In force"),ggds-tag--infofor something new or open ("New", "Open for comment"),ggds-tag--warningfor something that needs attention soon ("Closing soon", "To be confirmed"),ggds-tag--dangerfor something stopped or refused ("Revoked", "Rejected"), and plainggds-tagwhen the state is neither good nor bad ("Closed", "Draft"). - Use the same word and style for the same status everywhere on your website.
- Put the tag next to the thing it describes, such as after a title.
- Use only one tag per item. If an item needs several, the status is not clear yet.
Do
- Use words that make sense alone: "Closing soon".
- Keep a short list of statuses and use it everywhere.
Don't
- Rely on colour: a red tag saying "Status" tells people nothing.
- Write a sentence in a tag.
Accessibility
What GGDS does
- Every tag's text colour is checked against its background for at least 4.5:1 contrast by the GGDS tests (WCAG 1.4.3).
- Tags are bold and have a border in the text colour, so they keep their shape even where background colours are not shown.
What you need to do
- Let the words carry the meaning; the colour only supports them (WCAG 1.4.1).
- Check the tag reads well in order: a screen reader reads it as plain text with the words around it. If it is unclear, add visually hidden text such as
<span class="ggds-visually-hidden">Status: </span>. - Do not make a tag a link or button.
Example: Status tags
<p>
<strong class="ggds-tag ggds-tag--success">In force</strong>
<strong class="ggds-tag ggds-tag--info">Open for comment</strong>
<strong class="ggds-tag ggds-tag--warning">To be confirmed</strong>
<strong class="ggds-tag ggds-tag--danger">Revoked</strong>
<strong class="ggds-tag">Closed</strong>
</p><p>
<strong className="ggds-tag ggds-tag--success">In force</strong>
<strong className="ggds-tag ggds-tag--info">Open for comment</strong>
<strong className="ggds-tag ggds-tag--warning">To be confirmed</strong>
<strong className="ggds-tag ggds-tag--danger">Revoked</strong>
<strong className="ggds-tag">Closed</strong>
</p>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/tag.css(0.3 KB with gzip, minified).- 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
With @ggds/react:
import { Tag } from '@ggds/react';
<Tag type="success">In force</Tag>Django
No template tag: copy the HTML into your template.
Classes and states
| Class | What it does |
|---|---|
.ggds-tag | A neutral tag, such as "Closed" or "Draft". |
.ggds-tag--info | Information, such as "New". |
.ggds-tag--success | A good state, such as "Open". |
.ggds-tag--warning | Needs attention, such as "Closing soon". |
.ggds-tag--danger | A bad outcome, such as "Revoked" or "Rejected". |
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.2.0 | Fuller guidance for tags, breadcrumbs, disclosures, the skip link, pagination, rich text, tables and tab links. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.