Page structure
Layout
Classes that arrange content on a page: stacks, rows that wrap, grids and a side column, with the GGDS spacing, text sizes and colours.
When to use
- To arrange your own content between GGDS components: a list of services beside filters, a row of buttons, the parts of a card you made yourself.
- Instead of writing your own spacing and grid CSS, or adding a CSS framework, so pages keep the same rhythm on every government website.
When not to use
- To change how a GGDS component looks. Components already have their spacing; if one does not fit your page, tell us.
- For a set of links to similar pages. Use cards in a
ggds-card-grid. - To show different information on phones and computers. Hide only what is shown another way on that screen.
How to use
- Stack (
ggds-stack): put it on the element around things that go one above the other. It removes their own margins and puts the same space between each, so you do not set a margin on every paragraph. - Cluster (
ggds-cluster): for buttons, tags and links side by side. They wrap onto the next line on a phone. Addggds-cluster--spreadfor a title on one side and an action on the other. - Grid:
ggds-gridfits as many columns of at least 16rem as the screen allows, with no breakpoints to choose. When you need a set number, useggds-grid--2,--3or--4: always one column on phones. - Scroll row:
ggds-scroll-rowon a grid of cards turns it, on phones, into a row people swipe through sideways, so a long set does not make the page long. Each card snaps into place and the next one peeks in. Use it for sets people browse, such as examples, stories or related links, never for steps or anything people must read in order. If the cards hold no links, give the rowtabindex="0"and anaria-label, so keyboard users can scroll it. - Side column:
ggds-with-asideputs the main content and a 20rem column side by side from desktops, and one under the other before. Addggds-stickyto the side column to keep it in view while the page scrolls. - Gaps: change the space in a stack, cluster or grid with
ggds-gap-1toggds-gap-12, steps of the spacing scale. Use small steps inside a box, 4 and 6 between related things, and 8 and above between sections. - Text, surfaces and sizes: the text classes use the type scale and the two GGDS weights; the surface and border classes use the GGDS colours, so they keep their contrast in every theme.
- The layout classes sit in their own cascade layer,
ggds.utilities, after the components. A layout class on a component wins over the component's own spacing, and your own CSS still wins over GGDS without!important. If you name the layers yourself, keep the orderggds.base, ggds.components, ggds.utilities. - If you load GGDS one file at a time, add
components/layout.css.
Accessibility
What GGDS does
- Every layout is one column on a 320px phone and gains columns only as the screen allows, so the page never scrolls sideways, also with a wide font. Only a scroll row moves sideways, inside itself.
- The layout classes change only where things appear on the screen, never the order a screen reader or the keyboard follows.
ggds-text-mutedand the surfaces keep text at 4.5 to 1 contrast or more.
What you need to do
- Write the HTML in the order people should read it. A side column comes after the main content in the HTML.
- Do not hide information on a screen size with
ggds-from-tablet,ggds-from-desktoporggds-below-desktopunless it is shown another way on that screen. - Use
ggds-targetorggds-target-squareon anything people tap that is not a GGDS button, link list or field, so it is at least 44px. - Do not make body text smaller than
ggds-text-base; keepggds-text-smandggds-text-xsfor short labels and notes.
Example: Main content with a side column
<div class="ggds-with-aside" data-test="with-aside">
<div class="ggds-stack">
<h2>Apply for a broadcasting licence</h2>
<p>You need a licence to broadcast on radio or television in Ghana.</p>
<p class="ggds-text-muted ggds-text-sm">Last updated 3 November 2026</p>
<div class="ggds-cluster">
<a class="ggds-button" href="#apply">Start now</a>
<a href="#fees">See the fees</a>
</div>
</div>
<aside class="ggds-sticky ggds-surface-sunken ggds-rounded ggds-pad-4" aria-labelledby="related-heading">
<div class="ggds-stack ggds-gap-2">
<h2 class="ggds-text-lg" id="related-heading">Related</h2>
<a href="#renew">Renew a licence</a>
<a href="#transfer">Transfer a licence</a>
</div>
</aside>
</div><div className="ggds-with-aside" data-test="with-aside">
<div className="ggds-stack">
<h2>Apply for a broadcasting licence</h2>
<p>You need a licence to broadcast on radio or television in Ghana.</p>
<p className="ggds-text-muted ggds-text-sm">Last updated 3 November 2026</p>
<div className="ggds-cluster">
<a className="ggds-button" href="#apply">Start now</a>
<a href="#fees">See the fees</a>
</div>
</div>
<aside className="ggds-sticky ggds-surface-sunken ggds-rounded ggds-pad-4" aria-labelledby="related-heading">
<div className="ggds-stack ggds-gap-2">
<h2 className="ggds-text-lg" id="related-heading">Related</h2>
<a href="#renew">Renew a licence</a>
<a href="#transfer">Transfer a licence</a>
</div>
</aside>
</div>Example: A grid with a set number of columns
<ul class="ggds-grid ggds-grid--3 ggds-flush ggds-pad-0" data-test="grid-3" role="list">
<li class="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p class="ggds-text-sm ggds-text-muted">Licences issued this year</p>
<p class="ggds-text-2xl ggds-text-bold ggds-text-tight">1,284</p>
</li>
<li class="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p class="ggds-text-sm ggds-text-muted">Complaints resolved</p>
<p class="ggds-text-2xl ggds-text-bold ggds-text-tight">92%</p>
</li>
<li class="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p class="ggds-text-sm ggds-text-muted">Average days to decide</p>
<p class="ggds-text-2xl ggds-text-bold ggds-text-tight">14</p>
</li>
</ul><ul className="ggds-grid ggds-grid--3 ggds-flush ggds-pad-0" data-test="grid-3" role="list">
<li className="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p className="ggds-text-sm ggds-text-muted">Licences issued this year</p>
<p className="ggds-text-2xl ggds-text-bold ggds-text-tight">1,284</p>
</li>
<li className="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p className="ggds-text-sm ggds-text-muted">Complaints resolved</p>
<p className="ggds-text-2xl ggds-text-bold ggds-text-tight">92%</p>
</li>
<li className="ggds-stack ggds-gap-2 ggds-border ggds-rounded ggds-pad-4">
<p className="ggds-text-sm ggds-text-muted">Average days to decide</p>
<p className="ggds-text-2xl ggds-text-bold ggds-text-tight">14</p>
</li>
</ul>Example: A row that wraps, spread to both ends
<div class="ggds-stack">
<div class="ggds-cluster ggds-cluster--spread ggds-border-bottom">
<h2 class="ggds-flush">Notices</h2>
<a href="#all-notices">All notices</a>
</div>
<div class="ggds-cluster ggds-gap-2" data-test="cluster">
<strong class="ggds-tag">Spectrum</strong>
<strong class="ggds-tag">Consumer</strong>
<strong class="ggds-tag">Broadcasting</strong>
<span class="ggds-text-sm ggds-text-muted ggds-nowrap">12 November 2026</span>
</div>
</div><div className="ggds-stack">
<div className="ggds-cluster ggds-cluster--spread ggds-border-bottom">
<h2 className="ggds-flush">Notices</h2>
<a href="#all-notices">All notices</a>
</div>
<div className="ggds-cluster ggds-gap-2" data-test="cluster">
<strong className="ggds-tag">Spectrum</strong>
<strong className="ggds-tag">Consumer</strong>
<strong className="ggds-tag">Broadcasting</strong>
<span className="ggds-text-sm ggds-text-muted ggds-nowrap">12 November 2026</span>
</div>
</div>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/layout.css(1.2 KB with gzip, minified).- JavaScript
- None needed.
HTML
Copy the HTML under each example above. It works in any website.
Astro
With @ggds/astro:
<div class="ggds-with-aside">
<div class="ggds-stack">…</div>
<aside class="ggds-sticky">…</aside>
</div><div className="ggds-with-aside">
<div className="ggds-stack">…</div>
<aside className="ggds-sticky">…</aside>
</div>React and Next.js
No React component: switch the HTML under an example to JSX (React) and copy it.
Django
With ggds-django ({% load ggds %}):
<div class="ggds-with-aside">
<div class="ggds-stack">…</div>
<aside class="ggds-sticky">…</aside>
</div><div className="ggds-with-aside">
<div className="ggds-stack">…</div>
<aside className="ggds-sticky">…</aside>
</div>Classes and states
| Class | What it does |
|---|---|
.ggds-stack | Things one above the other with the same space between each (spacing 4 unless a gap class says otherwise). Their own top and bottom margins are removed. |
.ggds-cluster | Things side by side that wrap onto the next line: buttons, tags, links (gap 3). |
.ggds-cluster--spread | A cluster with its first and last parts at opposite ends. |
.ggds-cluster--top | A cluster aligned to the top, for parts of different heights. |
.ggds-cluster--baseline | A cluster aligned on the first line of text. |
.ggds-grid | As many columns of at least 16rem as fit; one column on phones (gap 4). Set --ggds-grid-min to change the width. |
.ggds-grid--2 | Two columns from tablets; one on phones. |
.ggds-grid--3 | Two columns from tablets, three from desktops; one on phones. |
.ggds-grid--4 | Two columns from tablets, four from desktops; one on phones. |
.ggds-with-aside | Main content with a 20rem side column from desktops (set --ggds-aside-width to change it); one column before (gap 8). |
.ggds-sticky | On desktops, stays in view while the page scrolls, clear of the header. For a side column. |
.ggds-center | Centres its content both ways. |
.ggds-grow | In a cluster: takes the room left over. |
.ggds-fixed | In a cluster: keeps its own width. |
.ggds-shrink | In a grid or cluster: may shrink below its content, so long words and tables do not widen the page. |
.ggds-push-down | Pushes the last part of a card or column to its bottom edge. |
.ggds-gap-* | The gap of a stack, cluster, grid or with-aside, from the spacing scale: 1, 2, 3, 4, 6, 8 or 12. |
.ggds-flush | No margin. |
.ggds-mt-* | Space above, from the spacing scale: 0, 2, 4, 6, 8 or 12. Prefer a stack. |
.ggds-mb-0 | No space below. |
.ggds-pad-* | Space inside, from the spacing scale: 0, 3, 4 or 6. |
.ggds-pad-fluid | Space inside: spacing 4 on phones, 8 from tablets. |
.ggds-text-xs | Text sizes from the type scale: xs, sm, base, lg, xl and 2xl (.ggds-text-sm and so on). |
.ggds-text-sm | Small text. |
.ggds-text-base | Body text size. |
.ggds-text-lg | Large text. |
.ggds-text-xl | Extra large text. |
.ggds-text-2xl | The size of a second-level heading. |
.ggds-text-regular | Regular weight. |
.ggds-text-bold | Bold. |
.ggds-text-muted | Secondary text colour, still easy to read (4.5 to 1 or more). |
.ggds-text-institution | The institution colour from its theme. |
.ggds-text-mono | The monospace font, for reference numbers and codes. |
.ggds-text-tight | Tight line height, for short text in cards and lists. |
.ggds-nowrap | Keeps text on one line: dates, amounts. |
.ggds-surface | The page background. |
.ggds-surface-raised | The raised surface, for a box above the page. |
.ggds-surface-sunken | The sunken surface, for a band or a box set into the page. |
.ggds-surface-brand | A light tint of the government blue. |
.ggds-border | A light border all round. |
.ggds-border-top | A light line above. |
.ggds-border-bottom | A light line below. |
.ggds-border-strong | Makes any of the borders above darker. |
.ggds-rounded | Rounded corners. |
.ggds-rounded-lg | Larger rounded corners. |
.ggds-rounded-full | Fully rounded ends: a pill or a circle. |
.ggds-clip | Hides what goes past its edges, so an image follows rounded corners. |
.ggds-cover | An image or video that fills its box, cropped rather than stretched. |
.ggds-full | Full width. |
.ggds-full-phone | Full width on phones only. |
.ggds-width-narrow | At most 42rem wide. |
.ggds-width-medium | At most 56rem wide. |
.ggds-target | At least 44px tall, the GGDS touch target. |
.ggds-target-square | A 44px square with its content centred, for an icon button. |
.ggds-from-tablet | Hidden on phones. |
.ggds-from-desktop | Hidden on phones and tablets. |
.ggds-below-desktop | Hidden on desktops. |
.ggds-scroll-row | On phones, a set of cards people swipe through sideways, each snapping into place with the next peeking in. From 48rem its own grid lays it out. Give it tabindex="0" and an aria-label if its cards hold no links, so keyboard users can scroll 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
- Behaviour test: “layout classes change columns at the breakpoints”
- Behaviour test: “no horizontal scrolling at 320px”
- Behaviour test: “no horizontal scrolling at 320px with a wide font”
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: layout classes, so a government website can arrange its own content with GGDS alone, with no CSS framework. Stacks (ggds-stack), rows that wrap (ggds-cluster), grids that are one column on phones (ggds-grid, ggds-grid--2 to --4), main content with a side column from desktops (ggds-with-aside, ggds-sticky), gaps from the spacing scale (ggds-gap-1 to ggds-gap-12), and classes for text size, weight and colour, surfaces, borders, corners, touch targets and showing parts on some screens only. They use only GGDS tokens and breakpoints and add about 1 KB with gzip. They are in ggds.css, or load components/layout.css. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.