Page structure
Hero
The top of a homepage, in your institution's colour. It asks visitors what they need.
When to use
- Once, on the homepage.
When not to use
- On inner pages. They start with breadcrumbs and a heading.
- For announcements. Use a notice.
How to use
- Purpose line (gold): one sentence on what your institution does.
- Heading: a question about the visitor's need.
- Search: a normal search form. It works without JavaScript.
- Common tasks: up to six links. On phones they form one row that scrolls sideways.
- A ministry that searches all its agencies can use
ggds-hero--hub, and tag each task with the agency that handles it. - Drawing (optional): add
ggds-hero--artand put an SVG inggds-hero__artwitharia-hidden="true". Use the shared animated drawing (ggds-hero-art, below) or your institution's own. It shows beside the text on wide screens and is hidden on phones. It only moves for people who have not asked their device for less motion.
Do
- Write tasks as things people do: "Make a complaint".
Don't
- Use department names as tasks.
- Add a photo slideshow.
Accessibility
What GGDS does
- Every theme is checked so white text and the gold purpose line stay readable.
- The search works without JavaScript, and its button keeps the word "Search" for screen readers when only the icon shows.
- The drawing is hidden from screen readers, is left out on phones, and moves only for people who have not asked for less motion.
What you need to do
- Write the heading as a real
<h1>. - Give the search box a label (it can be visually hidden).
- Add
aria-hidden="true"to your own drawing.
Example: Hero for a ministry and its agencies
<section class="ggds-hero ggds-hero--hub" aria-labelledby="hero-title">
<div class="ggds-hero__inner">
<div class="ggds-hero__body">
<p class="ggds-hero__purpose">We set policy for our sector and oversee the agencies that deliver it.</p>
<h1 class="ggds-hero__title" id="hero-title">What do you need today?</h1>
<p class="ggds-hero__lede">Tell us in your own words. We search the ministry and all its agencies at once and take you to the one that can help.</p>
<form class="ggds-hero__search" action="/search/" method="get" role="search">
<label class="ggds-visually-hidden" for="hero-q">What do you need today?</label>
<input class="ggds-hero__input" id="hero-q" name="q" type="search" required minlength="2" enterkeyhint="search" autocomplete="off" placeholder="e.g. renew a licence, report a scam">
<button class="ggds-hero__button" type="submit"><svg class="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p class="ggds-hero__tasks-label" id="hero-tasks">Most asked for:</p>
<ul class="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a class="ggds-hero__task" href="/agencies/licensing/">Apply for a licence <span class="ggds-hero__task-tag">Licensing Authority</span></a></li>
<li><a class="ggds-hero__task" href="/agencies/security/">Report a scam <span class="ggds-hero__task-tag">Security Agency</span></a></li>
<li><a class="ggds-hero__task" href="/agencies/weather/">Check today's weather <span class="ggds-hero__task-tag">Weather Agency</span></a></li>
</ul>
</div>
</div>
</section><section className="ggds-hero ggds-hero--hub" aria-labelledby="hero-title">
<div className="ggds-hero__inner">
<div className="ggds-hero__body">
<p className="ggds-hero__purpose">We set policy for our sector and oversee the agencies that deliver it.</p>
<h1 className="ggds-hero__title" id="hero-title">What do you need today?</h1>
<p className="ggds-hero__lede">Tell us in your own words. We search the ministry and all its agencies at once and take you to the one that can help.</p>
<form className="ggds-hero__search" action="/search/" method="get" role="search">
<label className="ggds-visually-hidden" htmlFor="hero-q">What do you need today?</label>
<input className="ggds-hero__input" id="hero-q" name="q" type="search" required minLength={2} enterKeyHint="search" autoComplete="off" placeholder="e.g. renew a licence, report a scam" />
<button className="ggds-hero__button" type="submit"><svg className="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p className="ggds-hero__tasks-label" id="hero-tasks">Most asked for:</p>
<ul className="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a className="ggds-hero__task" href="/agencies/licensing/">Apply for a licence <span className="ggds-hero__task-tag">Licensing Authority</span></a></li>
<li><a className="ggds-hero__task" href="/agencies/security/">Report a scam <span className="ggds-hero__task-tag">Security Agency</span></a></li>
<li><a className="ggds-hero__task" href="/agencies/weather/">Check today's weather <span className="ggds-hero__task-tag">Weather Agency</span></a></li>
</ul>
</div>
</div>
</section>Example: Hero for an agency, in its theme
<div data-ggds-theme="pcsrc">
<section class="ggds-hero" aria-labelledby="hero-title">
<div class="ggds-hero__inner">
<div class="ggds-hero__body">
<p class="ggds-hero__purpose">We regulate postal and courier services and protect their customers.</p>
<h1 class="ggds-hero__title" id="hero-title">What do you need help with?</h1>
<p class="ggds-hero__lede">Find a licensed courier, complain about a lost parcel or apply for a licence.</p>
<form class="ggds-hero__search" action="/search/" method="get" role="search">
<label class="ggds-visually-hidden" for="hero-q">Search this website</label>
<input class="ggds-hero__input" id="hero-q" name="q" type="search" required minlength="2" enterkeyhint="search" autocomplete="off" placeholder="Search this website">
<button class="ggds-hero__button" type="submit"><svg class="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p class="ggds-hero__tasks-label" id="hero-tasks">Common tasks:</p>
<ul class="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a class="ggds-hero__task" href="/services/postal-courier-licence/">How to get a courier licence</a></li>
<li><a class="ggds-hero__task" href="/news-notices/">Is this courier licensed?</a></li>
</ul>
</div>
</div>
</section>
</div><div data-ggds-theme="pcsrc">
<section className="ggds-hero" aria-labelledby="hero-title">
<div className="ggds-hero__inner">
<div className="ggds-hero__body">
<p className="ggds-hero__purpose">We regulate postal and courier services and protect their customers.</p>
<h1 className="ggds-hero__title" id="hero-title">What do you need help with?</h1>
<p className="ggds-hero__lede">Find a licensed courier, complain about a lost parcel or apply for a licence.</p>
<form className="ggds-hero__search" action="/search/" method="get" role="search">
<label className="ggds-visually-hidden" htmlFor="hero-q">Search this website</label>
<input className="ggds-hero__input" id="hero-q" name="q" type="search" required minLength={2} enterKeyHint="search" autoComplete="off" placeholder="Search this website" />
<button className="ggds-hero__button" type="submit"><svg className="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p className="ggds-hero__tasks-label" id="hero-tasks">Common tasks:</p>
<ul className="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a className="ggds-hero__task" href="/services/postal-courier-licence/">How to get a courier licence</a></li>
<li><a className="ggds-hero__task" href="/news-notices/">Is this courier licensed?</a></li>
</ul>
</div>
</div>
</section>
</div>Example: Hero with an animated drawing
<section class="ggds-hero ggds-hero--art" aria-labelledby="hero-title">
<div class="ggds-hero__inner">
<div class="ggds-hero__body">
<p class="ggds-hero__purpose">We license and regulate electronic communications.</p>
<h1 class="ggds-hero__title" id="hero-title">What do you need help with?</h1>
<p class="ggds-hero__lede">Find a service, make a complaint or look up a regulation.</p>
<form class="ggds-hero__search" action="/search/" method="get" role="search">
<label class="ggds-visually-hidden" for="hero-q">Search this website</label>
<input class="ggds-hero__input" id="hero-q" name="q" type="search" required minlength="2" enterkeyhint="search" autocomplete="off" placeholder="e.g. SIM registration">
<button class="ggds-hero__button" type="submit"><svg class="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p class="ggds-hero__tasks-label" id="hero-tasks">Common tasks:</p>
<ul class="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a class="ggds-hero__task" href="/services/type-approval/">Check a phone or device</a></li>
<li><a class="ggds-hero__task" href="/consumer-help/complaints/">Make a complaint</a></li>
</ul>
</div>
<div class="ggds-hero__art" aria-hidden="true">
<svg class="ggds-hero-art" viewBox="0 0 560 480" focusable="false" role="presentation">
<ellipse class="ggds-hero-art__shadow" cx="280" cy="405" rx="190" ry="28"/>
<path class="ggds-hero-art__orbit" d="M86 278C104 142 227 66 356 89s153 127 91 232"/>
<path class="ggds-hero-art__orbit ggds-hero-art__orbit--reverse" d="M100 337C173 407 323 421 444 326"/>
<g class="ggds-hero-art__plane">
<path class="ggds-hero-art__surface" d="M126 156 316 80l121 61-190 78z"/>
<path class="ggds-hero-art__side" d="m247 219 190-78v42l-190 78z"/>
</g>
<g class="ggds-hero-art__plane ggds-hero-art__plane--front">
<path class="ggds-hero-art__surface" d="M112 190 302 114l146 73-190 78z"/>
<path class="ggds-hero-art__side" d="m258 265 190-78v95l-190 78z"/>
<path class="ggds-hero-art__side" d="m112 190 146 75v95l-146-74z"/>
<path class="ggds-hero-art__edge" d="m258 265 190-78"/>
</g>
<path class="ggds-hero-art__links" d="m172 205 72-30 82 40 58-24m-212 14 86 60 68-50"/>
<circle class="ggds-hero-art__node" cx="172" cy="205" r="9"/><circle class="ggds-hero-art__node" cx="244" cy="175" r="9"/>
<circle class="ggds-hero-art__node" cx="326" cy="215" r="9"/><circle class="ggds-hero-art__node" cx="384" cy="191" r="9"/>
<g><circle class="ggds-hero-art__pulse" cx="326" cy="215" r="24"/><circle class="ggds-hero-art__pulse" cx="326" cy="215" r="43"/><circle class="ggds-hero-art__pulse" cx="326" cy="215" r="63"/></g>
</svg>
</div>
</div>
</section><section className="ggds-hero ggds-hero--art" aria-labelledby="hero-title">
<div className="ggds-hero__inner">
<div className="ggds-hero__body">
<p className="ggds-hero__purpose">We license and regulate electronic communications.</p>
<h1 className="ggds-hero__title" id="hero-title">What do you need help with?</h1>
<p className="ggds-hero__lede">Find a service, make a complaint or look up a regulation.</p>
<form className="ggds-hero__search" action="/search/" method="get" role="search">
<label className="ggds-visually-hidden" htmlFor="hero-q">Search this website</label>
<input className="ggds-hero__input" id="hero-q" name="q" type="search" required minLength={2} enterKeyHint="search" autoComplete="off" placeholder="e.g. SIM registration" />
<button className="ggds-hero__button" type="submit"><svg className="ggds-hero__button-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-hero__button-label">Search</span></button>
</form>
<p className="ggds-hero__tasks-label" id="hero-tasks">Common tasks:</p>
<ul className="ggds-hero__tasks" aria-labelledby="hero-tasks">
<li><a className="ggds-hero__task" href="/services/type-approval/">Check a phone or device</a></li>
<li><a className="ggds-hero__task" href="/consumer-help/complaints/">Make a complaint</a></li>
</ul>
</div>
<div className="ggds-hero__art" aria-hidden="true">
<svg className="ggds-hero-art" viewBox="0 0 560 480" focusable="false" role="presentation">
<ellipse className="ggds-hero-art__shadow" cx="280" cy="405" rx="190" ry="28" />
<path className="ggds-hero-art__orbit" d="M86 278C104 142 227 66 356 89s153 127 91 232" />
<path className="ggds-hero-art__orbit ggds-hero-art__orbit--reverse" d="M100 337C173 407 323 421 444 326" />
<g className="ggds-hero-art__plane">
<path className="ggds-hero-art__surface" d="M126 156 316 80l121 61-190 78z" />
<path className="ggds-hero-art__side" d="m247 219 190-78v42l-190 78z" />
</g>
<g className="ggds-hero-art__plane ggds-hero-art__plane--front">
<path className="ggds-hero-art__surface" d="M112 190 302 114l146 73-190 78z" />
<path className="ggds-hero-art__side" d="m258 265 190-78v95l-190 78z" />
<path className="ggds-hero-art__side" d="m112 190 146 75v95l-146-74z" />
<path className="ggds-hero-art__edge" d="m258 265 190-78" />
</g>
<path className="ggds-hero-art__links" d="m172 205 72-30 82 40 58-24m-212 14 86 60 68-50" />
<circle className="ggds-hero-art__node" cx="172" cy="205" r="9" /><circle className="ggds-hero-art__node" cx="244" cy="175" r="9" />
<circle className="ggds-hero-art__node" cx="326" cy="215" r="9" /><circle className="ggds-hero-art__node" cx="384" cy="191" r="9" />
<g><circle className="ggds-hero-art__pulse" cx="326" cy="215" r="24" /><circle className="ggds-hero-art__pulse" cx="326" cy="215" r="43" /><circle className="ggds-hero-art__pulse" cx="326" cy="215" r="63" /></g>
</svg>
</div>
</div>
</section>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/hero.css(1.7 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 Hero from '@ggds/astro/Hero.astro';
<Hero purpose="We regulate communications in Ghana." title="What do you need help with?"
search={{ action: '/search/', label: 'Search this website' }}
tasks={[{ label: 'Make a complaint', href: '/complaints/' }]} />React and Next.js
With @ggds/react:
import { Hero } from '@ggds/react';
<Hero title="What do you need to do?" purpose="We license businesses and protect consumers."
search={{ action: '/search/', label: 'Search Example Agency' }}
tasks={[{ label: 'Apply for a licence', href: '/services/licence/' }]} />Django
With ggds-django ({% load ggds %}):
{% ggds_hero title="What do you need help with?" purpose="We regulate communications in Ghana." search_action="/search/" tasks=tasks %}Classes and states
| Class | What it does |
|---|---|
.ggds-hero | The top of a homepage, in the institution's colour. |
.ggds-hero--hub | A ministry hub: one narrower, centred column for a search across all its agencies. |
.ggds-hero--art | Leaves room for a drawing beside the text on wide screens. |
.ggds-hero__inner | The content inside the page width. |
.ggds-hero__body | The text, search and tasks. |
.ggds-hero__purpose | The gold line saying what the institution does. |
.ggds-hero__title | The heading: a question about the visitor's need. |
.ggds-hero__lede | A short sentence under the heading. |
.ggds-hero__search | The search form. |
.ggds-hero__input | The search box. |
.ggds-hero__button | The search button. |
.ggds-hero__button-icon | The search button's icon. |
.ggds-hero__button-label | The search button's word, hidden on narrow screens but kept for screen readers. |
.ggds-hero__tasks-label | "Common tasks:" before the task links. |
.ggds-hero__tasks | The task links: one row that scrolls sideways on phones. |
.ggds-hero__task | A task link. |
.ggds-hero__task-tag | On a hub, the agency that handles the task. |
.ggds-hero__art | Holds the drawing (aria-hidden). Hidden on phones. |
.ggds-hero-art | The shared animated drawing. It moves only when the visitor has not asked for less motion. |
.ggds-hero-art__* | Parts of the shared drawing (plane, side, surface, shadow, orbit, node, edge, links, pulse). Not for other use. |
| State | What it does |
|---|---|
prefers-reduced-motion: reduce | The drawing stays still. |
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: “no horizontal scrolling at 320px”
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 | React and Astro: the banner's register link and the hero's search label now default to GGDS's own words, so you no longer have to pass them. React has errorTitle() for the page title while a form has errors. |
| 0.2.0 | The hero drawing (ggds-hero-art) and the documentation's homepage drawing now stop moving within 5 seconds of loading, so they meet WCAG 2.2.2 (Pause, Stop, Hide) without a pause button. Tests check that nothing animates for ever and time it in the browser. |
| 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 hero can show a drawing beside the text (ggds-hero--art), with a shared animated drawing, ggds-hero-art. It moves only for people who have not asked for less motion. |
| 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.