Content
Prose (rich text)
Styles for text from a content management system.
When to use
- Around HTML written in a content management system (CMS), such as a Wagtail rich text field or a WordPress post body.
When not to use
- Around GGDS components or forms. They have their own styles.
- Around the whole page. Wrap only the CMS text.
How to use
- Wrap the content in
ggds-prose. It styles headings h2 to h4, paragraphs, lists, links, quotes and tables, and keeps lines to a comfortable reading length. - Clean the HTML before you show it. GGDS only styles it; your website must remove unsafe code first, with an allow-list of tags. Remove pasted
styleattributes and fonts too. - Start CMS headings at h2. The page title is the only h1.
- Wrap tables in
ggds-table-wrapwhen you clean the HTML. Without it, table cells break long words so the table squeezes onto a narrow screen, but wide tables still need the wrapper. - For a link to a document, say what it is and how big: "Licence guide (PDF, 2 MB)". Many people pay for data by the megabyte.
Do
- Write link text that says where it goes: "Apply for a licence".
- Use real lists, not lines starting with dashes.
Don't
- Write "click here" or "read more".
- Pick a heading level for its size.
Accessibility
What GGDS does
- Links are underlined, so they are not shown by colour alone (WCAG 1.4.1).
- Headings, lists and quotes are styled so their structure is visible.
- Images shrink to fit the screen.
What you need to do
- Keep headings in order (h2, then h3) without skipping levels, so screen reader users can move through the page (WCAG 1.3.1).
- Make every link make sense on its own (WCAG 2.4.4).
- Give every image
alttext, oralt=""when it is decoration. - Clean the HTML before you show it: GGDS only styles it.
Example: Rich text from a CMS
<div class="ggds-prose">
<h2>Who needs a licence</h2>
<p>You need a licence to provide <a href="/services/">internet or voice services</a> to the public in Ghana.</p>
<ul>
<li>internet service providers</li>
<li>mobile network operators</li>
<li>community and commercial broadcasters</li>
</ul>
<h3>Exemptions</h3>
<p><strong>Private networks</strong> used only inside one organisation do not need a licence.</p>
<blockquote><p>Every operator shall publish its tariffs.</p></blockquote>
<table>
<caption>Processing times</caption>
<thead><tr><th scope="col">Application</th><th scope="col">Time</th></tr></thead>
<tbody><tr><td>New licence</td><td>30 working days</td></tr><tr><td>Renewal</td><td>10 working days</td></tr></tbody>
</table>
</div><div className="ggds-prose">
<h2>Who needs a licence</h2>
<p>You need a licence to provide <a href="/services/">internet or voice services</a> to the public in Ghana.</p>
<ul>
<li>internet service providers</li>
<li>mobile network operators</li>
<li>community and commercial broadcasters</li>
</ul>
<h3>Exemptions</h3>
<p><strong>Private networks</strong> used only inside one organisation do not need a licence.</p>
<blockquote><p>Every operator shall publish its tariffs.</p></blockquote>
<table>
<caption>Processing times</caption>
<thead><tr><th scope="col">Application</th><th scope="col">Time</th></tr></thead>
<tbody><tr><td>New licence</td><td>30 working days</td></tr><tr><td>Renewal</td><td>10 working days</td></tr></tbody>
</table>
</div>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/prose.css(0.4 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
No React component: switch the HTML under an example to JSX (React) and copy it.
Django
With ggds-django ({% load ggds %}):
{# Wagtail: a RichTextField, cleaned by Wagtail #}
<div class="ggds-prose">{{ page.body|richtext }}</div>Classes and states
| Class | What it does |
|---|---|
.ggds-prose | Styles the headings, lists, links, quotes and tables inside it, as text from a CMS arrives. |
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.