Content
Card
A box that sums up a page, service or document and links to it.
When to use
- For a set of links to pages of a similar kind, such as services.
When not to use
- For a single link in text. Use a normal link.
- For long text.
How to use
- Give each card a heading that is the link, and one short sentence below it.
- Put cards in a
ggds-card-grid: one column on phones, two on tablets, three on wide screens (ggds-card-grid--4for four). - For a page of services or topics, such as a homepage's "Popular services", add an icon:
ggds-card--icon, with a GGDS icon in<span class="ggds-card__icon">before the heading. Pick an icon that shows what the card is about, use a different one on each card, and keep the words: the icon only helps people scan. - For a list of institutions, use
ggds-card--institutionwithdata-ggds-theme: logo, names, what it does, up to two common tasks, and a line in its colour.
Accessibility
What GGDS does
- The whole card is clickable, but screen readers hear it as one link: its heading.
- The focus ring goes round the whole card, and task links in institution cards stay separate links.
What you need to do
- Make the card's heading a real heading at the right level, with the link inside it.
- Write link text that makes sense on its own, because people often list a page's links.
Example: Cards in a grid
<ul class="ggds-card-grid">
<li class="ggds-card">
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/licence/">Apply for a licence</a></h2>
<p class="ggds-card__body">Who needs one, what it costs and how to apply.</p>
</li>
<li class="ggds-card">
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/complaints/">Make a complaint</a></h2>
<p class="ggds-card__body">When your provider has not solved a problem.</p>
</li>
<li class="ggds-card">
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/laws-and-regulations/">Laws and regulations</a></h2>
<p class="ggds-card__body">Acts, regulations and guidelines in force.</p>
</li>
</ul><ul className="ggds-card-grid">
<li className="ggds-card">
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/licence/">Apply for a licence</a></h2>
<p className="ggds-card__body">Who needs one, what it costs and how to apply.</p>
</li>
<li className="ggds-card">
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/complaints/">Make a complaint</a></h2>
<p className="ggds-card__body">When your provider has not solved a problem.</p>
</li>
<li className="ggds-card">
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/laws-and-regulations/">Laws and regulations</a></h2>
<p className="ggds-card__body">Acts, regulations and guidelines in force.</p>
</li>
</ul>Example: Institution cards
<ul class="ggds-card-grid">
<li class="ggds-card ggds-card--institution" data-ggds-theme="nca">
<div class="ggds-card__head"><span class="ggds-header__monogram" aria-hidden="true">ECA</span><div>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/agencies/communications/">ECA</a></h2>
<p class="ggds-card__subtitle">Example Communications Authority</p></div></div>
<p class="ggds-card__body">Mobile networks, internet and broadcasting licences</p>
<ul class="ggds-card__actions">
<li><a class="ggds-card__action" href="/consumer-help/complaints/">Complain about your mobile network or internet</a></li>
<li><a class="ggds-card__action" href="/consumer-help/guides/">Check a licence</a></li>
</ul>
</li>
<li class="ggds-card ggds-card--institution" data-ggds-theme="gmet">
<div class="ggds-card__head"><span class="ggds-header__monogram" aria-hidden="true">EWA</span><div>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/agencies/weather/">EWA</a></h2>
<p class="ggds-card__subtitle">Example Weather Agency</p></div></div>
<p class="ggds-card__body">Weather forecasts and severe-weather warnings</p>
<ul class="ggds-card__actions">
<li><a class="ggds-card__action" href="/forecast/">Check today's weather forecast</a></li>
<li><a class="ggds-card__action" href="/warnings/">Severe-weather warnings</a></li>
</ul>
</li>
</ul><ul className="ggds-card-grid">
<li className="ggds-card ggds-card--institution" data-ggds-theme="nca">
<div className="ggds-card__head"><span className="ggds-header__monogram" aria-hidden="true">ECA</span><div>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/agencies/communications/">ECA</a></h2>
<p className="ggds-card__subtitle">Example Communications Authority</p></div></div>
<p className="ggds-card__body">Mobile networks, internet and broadcasting licences</p>
<ul className="ggds-card__actions">
<li><a className="ggds-card__action" href="/consumer-help/complaints/">Complain about your mobile network or internet</a></li>
<li><a className="ggds-card__action" href="/consumer-help/guides/">Check a licence</a></li>
</ul>
</li>
<li className="ggds-card ggds-card--institution" data-ggds-theme="gmet">
<div className="ggds-card__head"><span className="ggds-header__monogram" aria-hidden="true">EWA</span><div>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/agencies/weather/">EWA</a></h2>
<p className="ggds-card__subtitle">Example Weather Agency</p></div></div>
<p className="ggds-card__body">Weather forecasts and severe-weather warnings</p>
<ul className="ggds-card__actions">
<li><a className="ggds-card__action" href="/forecast/">Check today's weather forecast</a></li>
<li><a className="ggds-card__action" href="/warnings/">Severe-weather warnings</a></li>
</ul>
</li>
</ul>Example: Cards with icons
<ul class="ggds-card-grid">
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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="M4 10v10h16V10"/><path d="M3 4h18l-1 4.5a2.7 2.7 0 0 1-5.33 0 2.7 2.7 0 0 1-5.34 0 2.7 2.7 0 0 1-5.33 0z"/><path d="M10 20v-5h4v5"/></svg></span>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/permits/">Apply for a business permit</a></h2>
<p class="ggds-card__body">Who needs one, what it costs and how to apply online.</p>
</li>
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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="M14 17H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v5"/><path d="M8 8h8M8 12h4"/><circle cx="17" cy="14.5" r="3"/><path d="M15.5 17.2 15 21.5l2-1 2 1-.5-4.3"/></svg></span>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/renew/">Renew your licence</a></h2>
<p class="ggds-card__body">Renew before it ends, and keep trading without a break.</p>
</li>
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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="M16.6 7.4a6.5 6.5 0 1 0 0 9.2"/><path d="M12 3v18"/></svg></span>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/fees/">Pay a fee</a></h2>
<p class="ggds-card__body">Pay by mobile money or bank card, and get a receipt.</p>
</li>
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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="M5 5h14v10H9l-4 4z"/></svg></span>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/services/complaints/">Make a complaint</a></h2>
<p class="ggds-card__body">When a provider has not solved your problem.</p>
</li>
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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 21s-6.5-5.8-6.5-11a6.5 6.5 0 0 1 13 0c0 5.2-6.5 11-6.5 11z"/><circle cx="12" cy="10" r="2.5"/></svg></span>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/about/offices/">Find an office</a></h2>
<p class="ggds-card__body">Addresses and opening hours in every region.</p>
</li>
<li class="ggds-card ggds-card--icon">
<span class="ggds-card__icon"><svg class="ggds-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>
<h2 class="ggds-card__title"><a class="ggds-card__link" href="/laws-and-regulations/">Laws and regulations</a></h2>
<p class="ggds-card__body">The rules we enforce, and public consultations.</p>
</li>
</ul><ul className="ggds-card-grid">
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M4 10v10h16V10" /><path d="M3 4h18l-1 4.5a2.7 2.7 0 0 1-5.33 0 2.7 2.7 0 0 1-5.34 0 2.7 2.7 0 0 1-5.33 0z" /><path d="M10 20v-5h4v5" /></svg></span>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/permits/">Apply for a business permit</a></h2>
<p className="ggds-card__body">Who needs one, what it costs and how to apply online.</p>
</li>
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M14 17H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v5" /><path d="M8 8h8M8 12h4" /><circle cx="17" cy="14.5" r="3" /><path d="M15.5 17.2 15 21.5l2-1 2 1-.5-4.3" /></svg></span>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/renew/">Renew your licence</a></h2>
<p className="ggds-card__body">Renew before it ends, and keep trading without a break.</p>
</li>
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M16.6 7.4a6.5 6.5 0 1 0 0 9.2" /><path d="M12 3v18" /></svg></span>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/fees/">Pay a fee</a></h2>
<p className="ggds-card__body">Pay by mobile money or bank card, and get a receipt.</p>
</li>
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M5 5h14v10H9l-4 4z" /></svg></span>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/services/complaints/">Make a complaint</a></h2>
<p className="ggds-card__body">When a provider has not solved your problem.</p>
</li>
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false"><path d="M12 21s-6.5-5.8-6.5-11a6.5 6.5 0 0 1 13 0c0 5.2-6.5 11-6.5 11z" /><circle cx="12" cy="10" r="2.5" /></svg></span>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/about/offices/">Find an office</a></h2>
<p className="ggds-card__body">Addresses and opening hours in every region.</p>
</li>
<li className="ggds-card ggds-card--icon">
<span className="ggds-card__icon"><svg className="ggds-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>
<h2 className="ggds-card__title"><a className="ggds-card__link" href="/laws-and-regulations/">Laws and regulations</a></h2>
<p className="ggds-card__body">The rules we enforce, and public consultations.</p>
</li>
</ul>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/card.css(1.2 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 { Card, CardGrid } from '@ggds/react';
<CardGrid>
<Card icon="store" href="/services/permits/" title="Apply for a business permit">
Who needs one, what it costs and how to apply online.
</Card>
</CardGrid>Django
No template tag: copy the HTML into your template.
Classes and states
| Class | What it does |
|---|---|
.ggds-card-grid | Cards in a grid: one column on phones, two on tablets, three on wide screens. |
.ggds-card-grid--4 | Four columns on wide screens. |
.ggds-card | A card. The whole card is clickable through its title link. |
.ggds-card__title | The card's heading. |
.ggds-card__link | The heading's link; it stretches over the whole card. |
.ggds-card__body | One short sentence. |
.ggds-card--icon | A card with a GGDS icon above its title, for a page of services or topics. |
.ggds-card__icon | The icon's circle, tinted with the institution colour; the icon inside is hidden from screen readers. |
.ggds-card--institution | An institution card, with a line in that institution's colour (data-ggds-theme). |
.ggds-card__head | An institution card's logo and names. |
.ggds-card__logo | The institution's logo or initials. |
.ggds-card__subtitle | The institution's full name under its short name. |
.ggds-card__actions | Up to two task links, above the card's own link. |
.ggds-card__action | A task link. |
| State | What it does |
|---|---|
:hover on .ggds-card__link | The card's border darkens and it lifts slightly (unless the visitor asked for less motion). |
:focus-visible on .ggds-card__link | The gold focus ring goes round the whole card. |
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.3.0 | Card: new ggds-card--icon, a card with a GGDS icon in a circle tinted with the institution colour, for pages of services or topics; beside the title on phones, above it on wider screens. The documentation's cards use it. |
| 0.3.0 | Card grid: space below it, so the next section's heading is not cramped. |
| 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 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.