Tutorial: build a page and a sign-in form
Set GGDS up, make a government web page, then a sign-in page that tells people clearly what to fix. You need a text editor and a web browser. It takes about 20 minutes.
You will make four files: a service page, a sign-in page, the script that checks the sign-in form, and the page people see once they are signed in. Then you will give them your institution's colour with a ready-made theme. Every page in this tutorial is tested by GGDS for accessibility, on computers and phones.
Step 1: Set GGDS up
Make a new folder for your website, such as my-service. Then choose one way to add GGDS. You can change later: only the lines that load GGDS are different.
| Way | Best for | You need |
|---|---|---|
| A CDN link | Trying GGDS out, and this tutorial | Nothing else |
| The download | A live website without build tools | The GGDS zip |
| npm | A website with a build step, such as Vite, Astro or Next.js | Node.js |
Building with React, Next.js, Vue, Svelte, Angular, Django or WordPress? This tutorial works the same in plain HTML, and Set it up in your framework shows where each part goes in yours. React has its own components, in @ggds/react.
From a CDN (quickest)
A CDN serves the GGDS files from the internet, so there is nothing to download. Put these two lines in the <head> of each page. The pages in this tutorial already have them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ggds/css@0.5.0/dist/ggds.min.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@ggds/js@0.5.0/dist/auto.js"></script>Always name the exact version, as here (@0.5.0), so your pages do not change when GGDS does. For a live government website, use the download or npm instead: then your website does not depend on another company's service.
From the download
- Download
ggds-0.5.0.zipfrom the latest GitHub release. - Unzip it and copy the
ggdsfolder into yourmy-servicefolder. - In each page, use these two lines instead of the CDN links:
<link rel="stylesheet" href="ggds/ggds.min.css">
<script type="module" src="ggds/auto.js"></script>In sign-in.js (step 4), import from './ggds/index.js' instead of the CDN address.
From npm
With Node.js installed, make a project with Vite and add GGDS:
npm create vite@latest my-service -- --template vanilla
cd my-service
npm install @ggds/css @ggds/jsDelete the example files Vite made in src/, and put this in src/main.js:
import '@ggds/css/ggds.css';
import '@ggds/js/auto';In each page, use this line in the <head> instead of the CDN links:
<script type="module" src="/src/main.js"></script>Put sign-in.js in src/, load it with <script type="module" src="/src/sign-in.js"></script>, and import from '@ggds/js'. Run npm run dev and open the address it shows. Before you build for production, list every page as Vite's guide to multi-page apps says.
Step 2: Make a page
Make index.html in your folder and copy this into it. It has the parts every government website needs, in this order:
- a skip link, for people who use a keyboard
- the government website banner, so people can tell the website is official
- the header, with your institution's name and main sections
- the page's content, in
<main>, starting with one<h1> - the footer
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example Agency</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ggds/css@0.5.0/dist/ggds.min.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@ggds/js@0.5.0/dist/auto.js"></script>
</head>
<body>
<a class="ggds-skip-link" href="#main">Skip to main content</a>
<section class="ggds-banner" aria-label="Official government website">
<details class="ggds-banner__details ggds-container">
<summary class="ggds-banner__summary">
<svg class="ggds-banner__flag" viewBox="0 0 30 20" aria-hidden="true" focusable="false">
<rect class="ggds-banner__flag-red" width="30" height="6.67"/>
<rect class="ggds-banner__flag-gold" y="6.67" width="30" height="6.67"/>
<rect class="ggds-banner__flag-green" y="13.33" width="30" height="6.67"/>
<polygon class="ggds-banner__flag-star" points="15,6.8 15.73,8.99 18.04,9.01 16.19,10.39 16.88,12.59 15,11.25 13.12,12.59 13.81,10.39 11.96,9.01 14.27,8.99"/>
</svg>
<span class="ggds-banner__text">An official website of the Government of Ghana</span>
<span class="ggds-banner__toggle">How to tell</span>
</summary>
<div class="ggds-banner__content">
<div class="ggds-banner__item">
<p class="ggds-banner__heading">Check the address</p>
<p>The official address of this website is <strong>www.example.gov.gh</strong>. Most government websites end in <strong>.gov.gh</strong>, but some official websites do not.</p>
</div>
<div class="ggds-banner__item">
<p class="ggds-banner__heading">We will never ask for your PIN</p>
<p>Government officials will never ask for your PIN, password or mobile money code, by phone, by SMS or on a website.</p>
</div>
</div>
</details>
</section>
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="index.html">
<span class="ggds-header__monogram" aria-hidden="true">EA</span>
<span class="ggds-header__text">
<span class="ggds-header__name">Example Agency</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="index.html">Services</a></li>
<li><a class="ggds-header__link" href="sign-in.html">Sign in</a></li>
</ul>
</nav>
<button type="button" class="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" 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 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" 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="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header>
<main class="ggds-main ggds-container" id="main" tabindex="-1">
<h1>Apply for a business permit</h1>
<p class="ggds-lead ggds-measure">Apply online for a permit to run a business in Ghana. It takes about 15 minutes.</p>
<div class="ggds-prose">
<h2>Before you start</h2>
<p>You will need:</p>
<ul>
<li>your Ghana Card number</li>
<li>your business registration certificate</li>
</ul>
</div>
<p><a class="ggds-button" href="sign-in.html">Start now</a></p>
</main>
<footer class="ggds-footer">
<div class="ggds-container ggds-footer__main">
<div>
<p class="ggds-footer__identity"><span class="ggds-header__monogram" aria-hidden="true">EA</span><span>Example Agency</span></p>
<p class="ggds-footer__purpose">We license businesses and protect consumers.</p>
</div>
</div>
<div class="ggds-footer__bottom">
<ul class="ggds-container ggds-footer__bar">
<li>© 2026 Example Agency</li>
<li><a href="accessibility.html">Accessibility</a></li>
<li><a href="privacy.html">Privacy</a></li>
</ul>
</div>
</footer>
</body>
</html>
Open the file in your browser. Make the window narrow: on a phone-sized screen the sections move into a menu.
To make the page your own, change "Example Agency", the initials (EA), the sections and the content. Keep the parts in the same order.
Step 3: Make a sign-in page
Make sign-in.html. The header, banner and footer are the same as before; only <main> and the page title are new.
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sign in | Example Agency</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ggds/css@0.5.0/dist/ggds.min.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@ggds/js@0.5.0/dist/auto.js"></script>
<script type="module" src="sign-in.js"></script>
</head>
<body>
<a class="ggds-skip-link" href="#main">Skip to main content</a>
<section class="ggds-banner" aria-label="Official government website">
<details class="ggds-banner__details ggds-container">
<summary class="ggds-banner__summary">
<svg class="ggds-banner__flag" viewBox="0 0 30 20" aria-hidden="true" focusable="false">
<rect class="ggds-banner__flag-red" width="30" height="6.67"/>
<rect class="ggds-banner__flag-gold" y="6.67" width="30" height="6.67"/>
<rect class="ggds-banner__flag-green" y="13.33" width="30" height="6.67"/>
<polygon class="ggds-banner__flag-star" points="15,6.8 15.73,8.99 18.04,9.01 16.19,10.39 16.88,12.59 15,11.25 13.12,12.59 13.81,10.39 11.96,9.01 14.27,8.99"/>
</svg>
<span class="ggds-banner__text">An official website of the Government of Ghana</span>
<span class="ggds-banner__toggle">How to tell</span>
</summary>
<div class="ggds-banner__content">
<div class="ggds-banner__item">
<p class="ggds-banner__heading">Check the address</p>
<p>The official address of this website is <strong>www.example.gov.gh</strong>. Most government websites end in <strong>.gov.gh</strong>, but some official websites do not.</p>
</div>
<div class="ggds-banner__item">
<p class="ggds-banner__heading">We will never ask for your PIN</p>
<p>Government officials will never ask for your PIN, password or mobile money code, by phone, by SMS or on a website.</p>
</div>
</div>
</details>
</section>
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="index.html">
<span class="ggds-header__monogram" aria-hidden="true">EA</span>
<span class="ggds-header__text">
<span class="ggds-header__name">Example Agency</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="index.html">Services</a></li>
<li><a class="ggds-header__link" href="sign-in.html">Sign in</a></li>
</ul>
</nav>
<button type="button" class="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" 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 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" 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="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header>
<main class="ggds-main ggds-container" id="main" tabindex="-1">
<div class="ggds-error-summary" role="alert" aria-labelledby="error-summary-title" tabindex="-1" hidden>
<h2 class="ggds-error-summary__title" id="error-summary-title">There is a problem</h2>
<ul class="ggds-error-summary__list"></ul>
</div>
<h1>Sign in to your account</h1>
<form id="sign-in" method="post" novalidate>
<div class="ggds-field">
<label class="ggds-label" for="email">Email address</label>
<input class="ggds-input ggds-input--width-long" id="email" name="email" type="email" autocomplete="username" spellcheck="false">
</div>
<div class="ggds-field">
<label class="ggds-label" for="password">Password</label>
<input class="ggds-input ggds-input--width-medium" id="password" name="password" type="password" autocomplete="current-password">
</div>
<div class="ggds-button-group">
<button class="ggds-button" type="submit">Sign in</button>
<a href="forgotten-password.html">Forgotten your password?</a>
</div>
</form>
<h2>If you do not have an account</h2>
<p><a href="create-account.html">Create an account</a>. You will need your Ghana Card number.</p>
</main>
<footer class="ggds-footer">
<div class="ggds-container ggds-footer__main">
<div>
<p class="ggds-footer__identity"><span class="ggds-header__monogram" aria-hidden="true">EA</span><span>Example Agency</span></p>
<p class="ggds-footer__purpose">We license businesses and protect consumers.</p>
</div>
</div>
<div class="ggds-footer__bottom">
<ul class="ggds-container ggds-footer__bar">
<li>© 2026 Example Agency</li>
<li><a href="accessibility.html">Accessibility</a></li>
<li><a href="privacy.html">Privacy</a></li>
</ul>
</div>
</footer>
</body>
</html>
What makes this sign-in page work well for everyone:
- Every box has a
<label>, so screen readers say what it is for and people can tap the words to reach the box. autocomplete="username"andautocomplete="current-password"let browsers and password managers fill the details in. People who use them make stronger passwords.type="email"shows the @ key on phones;spellcheck="false"stops the browser marking the address as a spelling mistake.method="post"sends the password in the body of the request, never in the web address. The form has noaction, so it is sent back to the same address: your server shows the sign-in page and checks it at one address.novalidateturns off the browser's own error messages, which are hard to read and differ in every browser. GGDS's error messages replace them in step 4.- The error summary is already in the page, hidden, so the script in step 4 only has to fill it in.
Step 4: Show errors
When someone leaves a box empty or types an email address wrongly, GGDS shows the problem in three places, so everyone notices it:
- an error summary at the top of the page, which takes the keyboard focus, so screen readers read it first; each problem links to its box
- a red message above the box, saying what to do: "Enter your email address", not "Invalid input"
- "Error:" at the start of the page title, which is the first thing a screen reader says
Make sign-in.js next to sign-in.html. It checks the form when it is sent and shows any problems this way.
// Checks the sign-in form in the browser and shows any errors the GGDS way: a summary at the top of the page,
// a message on each field, and "Error:" at the start of the page title. Your server must check the details
// again: this only saves people waiting for the page to reload.
import { initErrorSummary } from 'https://cdn.jsdelivr.net/npm/@ggds/js@0.5.0/dist/index.js';
const form = document.getElementById('sign-in');
const summary = document.querySelector('.ggds-error-summary');
const pageTitle = document.title;
// What to check, and the message for each problem. Say what to do, not what went wrong.
const checks = {
email: (value) => {
if (!value) return 'Enter your email address';
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) return 'Enter an email address in the correct format, like name@example.com';
return '';
},
password: (value) => (value ? '' : 'Enter your password'),
};
/** Shows or clears the error on one field. */
function setError(input, message) {
const field = input.closest('.ggds-field');
const id = `${input.id}-error`;
document.getElementById(id)?.remove();
field.classList.toggle('ggds-field--error', Boolean(message));
if (!message) {
input.removeAttribute('aria-invalid');
input.removeAttribute('aria-describedby');
return;
}
const error = document.createElement('p');
error.className = 'ggds-error-message';
error.id = id;
const hidden = document.createElement('span');
hidden.className = 'ggds-visually-hidden';
hidden.textContent = 'Error:';
error.append(hidden, ` ${message}`);
input.before(error);
input.setAttribute('aria-invalid', 'true');
input.setAttribute('aria-describedby', id);
}
form.addEventListener('submit', (event) => {
const errors = [];
for (const [name, check] of Object.entries(checks)) {
const input = form.elements[name];
const message = check(input.value.trim());
setError(input, message);
if (message) errors.push({ id: input.id, message });
}
if (errors.length === 0) {
// This tutorial has no server, so go to the next page here. With a server, delete these two lines:
// the form then sends the details to your server, which signs the person in or shows the errors.
event.preventDefault();
window.location.href = 'account.html';
return;
}
event.preventDefault();
const list = summary.querySelector('.ggds-error-summary__list');
list.replaceChildren(...errors.map(({ id, message }) => {
const item = document.createElement('li');
const link = document.createElement('a');
link.href = `#${id}`;
link.textContent = message;
item.append(link);
return item;
}));
summary.hidden = false;
document.title = `Error: ${pageTitle}`;
// The first time, GGDS's script moves focus to the summary and makes its links work; after that, just focus it.
if (summary.dataset.ggdsReady) summary.focus();
else initErrorSummary(summary);
});
Try the finished sign-in page: send it empty, then with a wrong email address
The script is loaded from its own file, not written into the page, so it runs under a strict Content Security Policy.
Errors from your server
The script only saves people a wait: your server must check the details again, and it is the only thing that can tell whether the password is right. When it is not, the server sends the sign-in page back with the same parts written in, and GGDS's script moves the focus to the summary:
<div class="ggds-error-summary" data-ggds-module="error-summary" role="alert" aria-labelledby="error-summary-title" tabindex="-1">
<h2 class="ggds-error-summary__title" id="error-summary-title">There is a problem</h2>
<ul class="ggds-error-summary__list">
<li><a href="#email">Enter a correct email address and password</a></li>
</ul>
</div>
<h1>Sign in to your account</h1>
<form id="sign-in" method="post" novalidate>
<div class="ggds-field ggds-field--error">
<label class="ggds-label" for="email">Email address</label>
<p class="ggds-error-message" id="email-error"><span class="ggds-visually-hidden">Error:</span> Enter a correct email address and password</p>
<input class="ggds-input ggds-input--width-long" id="email" name="email" type="email" autocomplete="username" spellcheck="false" value="kofi@example.com" aria-invalid="true" aria-describedby="email-error">
</div>
…the password field, empty, and the rest of the form as before…
</form><>
<div className="ggds-error-summary" data-ggds-module="error-summary" role="alert" aria-labelledby="error-summary-title" tabIndex={-1}>
<h2 className="ggds-error-summary__title" id="error-summary-title">There is a problem</h2>
<ul className="ggds-error-summary__list">
<li><a href="#email">Enter a correct email address and password</a></li>
</ul>
</div>
<h1>Sign in to your account</h1>
<form id="sign-in" method="post" noValidate>
<div className="ggds-field ggds-field--error">
<label className="ggds-label" htmlFor="email">Email address</label>
<p className="ggds-error-message" id="email-error"><span className="ggds-visually-hidden">Error:</span> Enter a correct email address and password</p>
<input className="ggds-input ggds-input--width-long" id="email" name="email" type="email" autoComplete="username" spellCheck="false" defaultValue="kofi@example.com" aria-invalid="true" aria-describedby="email-error" />
</div>
…the password field, empty, and the rest of the form as before…
</form>
</>When the email address or password is wrong, do not say which: "Enter a correct email address and password". Saying which one is wrong tells an attacker which email addresses have accounts. Keep what the person typed in the email address box, but never send the password back.
Step 5: The page after signing in
Make account.html, the page people see once they are signed in. The tutorial's script goes there when the form is filled in; with a server, the server sends people there.
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Your account | Example Agency</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ggds/css@0.5.0/dist/ggds.min.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@ggds/js@0.5.0/dist/auto.js"></script>
</head>
<body>
<a class="ggds-skip-link" href="#main">Skip to main content</a>
<section class="ggds-banner" aria-label="Official government website">
<details class="ggds-banner__details ggds-container">
<summary class="ggds-banner__summary">
<svg class="ggds-banner__flag" viewBox="0 0 30 20" aria-hidden="true" focusable="false">
<rect class="ggds-banner__flag-red" width="30" height="6.67"/>
<rect class="ggds-banner__flag-gold" y="6.67" width="30" height="6.67"/>
<rect class="ggds-banner__flag-green" y="13.33" width="30" height="6.67"/>
<polygon class="ggds-banner__flag-star" points="15,6.8 15.73,8.99 18.04,9.01 16.19,10.39 16.88,12.59 15,11.25 13.12,12.59 13.81,10.39 11.96,9.01 14.27,8.99"/>
</svg>
<span class="ggds-banner__text">An official website of the Government of Ghana</span>
<span class="ggds-banner__toggle">How to tell</span>
</summary>
<div class="ggds-banner__content">
<div class="ggds-banner__item">
<p class="ggds-banner__heading">Check the address</p>
<p>The official address of this website is <strong>www.example.gov.gh</strong>. Most government websites end in <strong>.gov.gh</strong>, but some official websites do not.</p>
</div>
<div class="ggds-banner__item">
<p class="ggds-banner__heading">We will never ask for your PIN</p>
<p>Government officials will never ask for your PIN, password or mobile money code, by phone, by SMS or on a website.</p>
</div>
</div>
</details>
</section>
<header class="ggds-header">
<div class="ggds-container ggds-header__inner">
<a class="ggds-header__identity" href="index.html">
<span class="ggds-header__monogram" aria-hidden="true">EA</span>
<span class="ggds-header__text">
<span class="ggds-header__name">Example Agency</span>
<span class="ggds-header__country">Republic of Ghana</span>
<span class="ggds-visually-hidden"> – home</span>
</span>
</a>
<nav class="ggds-header__nav" id="ggds-header-nav" aria-label="Main">
<ul class="ggds-header__list">
<li><a class="ggds-header__link" href="index.html">Services</a></li>
<li><a class="ggds-header__link" href="sign-in.html">Sign in</a></li>
</ul>
</nav>
<button type="button" class="ggds-header__menu-button" aria-controls="ggds-header-nav" aria-expanded="false" hidden><svg class="ggds-header__icon ggds-header__icon--menu" 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 6h16M4 12h16M4 18h16"/></svg><svg class="ggds-header__icon ggds-header__icon--close" 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="M6 6l12 12M18 6 6 18"/></svg><span class="ggds-visually-hidden">Menu</span></button>
</div>
</header>
<main class="ggds-main ggds-container" id="main" tabindex="-1">
<h1>Your account</h1>
<p class="ggds-lead ggds-measure">You are signed in.</p>
<ul class="ggds-card-grid">
<li class="ggds-card"><h2 class="ggds-card__title"><a class="ggds-card__link" href="index.html">Apply for a business permit</a></h2><p class="ggds-card__body">Start a new application.</p></li>
<li class="ggds-card"><h2 class="ggds-card__title"><a class="ggds-card__link" href="applications.html">Your applications</a></h2><p class="ggds-card__body">See where your applications are.</p></li>
</ul>
</main>
<footer class="ggds-footer">
<div class="ggds-container ggds-footer__main">
<div>
<p class="ggds-footer__identity"><span class="ggds-header__monogram" aria-hidden="true">EA</span><span>Example Agency</span></p>
<p class="ggds-footer__purpose">We license businesses and protect consumers.</p>
</div>
</div>
<div class="ggds-footer__bottom">
<ul class="ggds-container ggds-footer__bar">
<li>© 2026 Example Agency</li>
<li><a href="accessibility.html">Accessibility</a></li>
<li><a href="privacy.html">Privacy</a></li>
</ul>
</div>
</footer>
</body>
</html>
Step 6: Use a ready-made theme
Every government website looks the same except for one thing: the institution's colour. A theme sets it. It changes five places only: the line under the header, the institution's name, the homepage hero, the footer and the institution's card in a list. Links, buttons, form fields and error messages stay the same on every government website, so people recognise them wherever they are.
Choose your theme
GGDS has a ready-made theme for each of these institutions. Without one, your website uses the default, Ministry of Communication, Digital Technology and Innovations.
| Colour | Institution | Theme name |
|---|---|---|
| Ministry of Communication, Digital Technology and Innovations (MoCDTI) | mocdti | |
| Cyber Security Authority (CSA) | csa | |
| Data Protection Commission (DPC) | dpc | |
| Ghana Digital Centres Limited (GDCL) | gdcl | |
| Ghana Domain Name Registry (GDNR) | gdnr | |
| Ghana Investment Fund for Electronic Communications (GIFEC) | gifec | |
| Ghana Meteorological Agency (GMet) | gmet | |
| Ghana Post Company Limited (Ghana Post) | gpcl | |
| Ghana-India Kofi Annan Centre of Excellence in ICT (GI-KACE) | gi-kace | |
| National Communications Authority (NCA) | nca | |
| National Information Technology Agency (NITA) | nita | |
| Postal and Courier Services Regulatory Commission (PCSRC) | pcsrc |
Add it to your pages
Load the theme after the GGDS stylesheet, in every page. This example uses the National Communications Authority's theme, nca: put your theme's name in its place.
From the CDN, add this line under the GGDS stylesheet:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ggds/themes@0.5.0/dist/nca.css">From the download, the themes are already in the ggds/themes folder:
<link rel="stylesheet" href="ggds/themes/nca.css">With npm, install the themes and import yours in src/main.js, after GGDS:
npm install @ggds/themesimport '@ggds/css/ggds.css';
import '@ggds/themes/nca.css';
import '@ggds/js/auto';Reload the page: the line under the header, your institution's name and the footer are now in its colour.
Try it with other themes: NCA, GMet, CSA. See every theme on a whole page on Themes.
If your institution has no theme yet
Make one from your institution's colour. The colour must have at least 4.5:1 contrast on white, because the header writes your institution's name in it; GGDS checks this for you and makes the darker shade the footer needs. With Node.js, run npm install @ggds/tokens, then save this as make-theme.mjs and run node make-theme.mjs:
import { writeFileSync } from 'node:fs';
import { institutionColourProblems, institutionCss } from '@ggds/tokens/institution.mjs';
const colour = '#006e35'; // your institution's colour
const problems = institutionColourProblems(colour);
if (problems.length) throw new Error(problems.join('\n')); // for example: too light to read on white
writeFileSync('my-theme.css', institutionCss(colour));It writes my-theme.css. Load it after the GGDS stylesheet, like a ready-made theme. To have your institution's theme added to GGDS, ask for it on GitHub with your approved colour.
Several institutions on one page
A ministry's list of its agencies shows each agency in its own colour. Load themes.css, which has every theme, instead of one theme, and put data-ggds-theme with the theme's name on each agency's card:
<link rel="stylesheet" href="ggds/themes/themes.css">
<li class="ggds-card ggds-card--institution" data-ggds-theme="nca">…</li>
<li class="ggds-card ggds-card--institution" data-ggds-theme="gmet">…</li>Never set the colour with a style attribute: a strict Content Security Policy blocks it.
Before you go live
A sign-in page protects people's information. Before it is used for real:
- Serve the website over HTTPS only.
- Check every detail again on the server, and store passwords only as a slow hash (such as Argon2 or bcrypt), never as they were typed.
- Slow down repeated wrong attempts, and tell the person by email or SMS when their account is signed in to from a new device.
- Let people paste into the password box: blocking it stops password managers.
- Serve the GGDS files yourself (the download or npm), as Get started as a developer explains, and set a strict Content Security Policy.
- Test the pages with a keyboard only, with a screen reader, at 200% zoom and on a low-cost phone. GGDS has tested its parts; you need to test how you put them together.
Next steps
- Read the pattern for asking for information before you build longer forms, and the Ghana Card number pattern to ask for it.
- Browse the components and icons.
- For Django, WordPress or Astro, see Get started as a developer: they write this HTML for you.
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.