Content
Meter
An amount drawn as a bar, so people can compare rows of a table at a glance: a chart that is still a table.
When to use
- In a table, to compare one amount across rows: rainfall by region, applications by office.
- For how full something is, such as places left at a session.
When not to use
- On its own, without the number in words next to it.
- For progress through a task: use progress.
- For data that needs a real chart, such as a trend over time: show the table, and a chart image with a text description.
How to use
- Put the number in its own cell, then the meter in the next. The number is what people read; the bar is for comparing.
- Use a native
<meter>withmin,maxandvalue: no style attributes, so it works under a strict Content Security Policy. - Use the same
maxon every row, a round number just above the largest value, so the bars compare fairly. - Hide the meter from screen readers with
aria-hidden="true": the number in the table says it already. - Say the unit in the table’s caption or column heading.
Do
- Show the number next to every bar.
- Use one scale for the whole table.
Don't
- Start the scale above zero: it exaggerates differences.
Accessibility
What GGDS does
- The meter is a native element, drawn in the institution’s colour, with no script.
- In Windows contrast themes it keeps an outline.
What you need to do
- Keep the number in text next to the meter (WCAG 1.1.1 and 1.4.1).
- Hide the meter from screen readers, so the number is not read twice.
Example: Meters in a table
<div class="ggds-table-wrap" role="region" aria-labelledby="rain-caption" tabindex="0">
<table class="ggds-table">
<caption class="ggds-table__caption" id="rain-caption">Rainfall by region, April to July 2026, in millimetres</caption>
<thead>
<tr>
<th scope="col">Region</th>
<th scope="col" class="ggds-table__numeric">Rainfall</th>
<th scope="col"><span class="ggds-visually-hidden">Rainfall as a bar</span></th>
<th scope="col" class="ggds-table__numeric">Normal</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Western</th>
<td class="ggds-table__numeric">1020</td>
<td><meter class="ggds-meter" min="0" max="1100" value="1020" aria-hidden="true">1020 mm</meter></td>
<td class="ggds-table__numeric">880</td>
</tr>
<tr>
<th scope="row">Volta</th>
<td class="ggds-table__numeric">812</td>
<td><meter class="ggds-meter" min="0" max="1100" value="812" aria-hidden="true">812 mm</meter></td>
<td class="ggds-table__numeric">700</td>
</tr>
<tr>
<th scope="row">Ashanti</th>
<td class="ggds-table__numeric">744</td>
<td><meter class="ggds-meter" min="0" max="1100" value="744" aria-hidden="true">744 mm</meter></td>
<td class="ggds-table__numeric">770</td>
</tr>
<tr>
<th scope="row">Greater Accra</th>
<td class="ggds-table__numeric">512</td>
<td><meter class="ggds-meter" min="0" max="1100" value="512" aria-hidden="true">512 mm</meter></td>
<td class="ggds-table__numeric">430</td>
</tr>
</tbody>
</table>
</div>
<p class="ggds-hint">Example figures only.</p><>
<div className="ggds-table-wrap" role="region" aria-labelledby="rain-caption" tabIndex={0}>
<table className="ggds-table">
<caption className="ggds-table__caption" id="rain-caption">Rainfall by region, April to July 2026, in millimetres</caption>
<thead>
<tr>
<th scope="col">Region</th>
<th scope="col" className="ggds-table__numeric">Rainfall</th>
<th scope="col"><span className="ggds-visually-hidden">Rainfall as a bar</span></th>
<th scope="col" className="ggds-table__numeric">Normal</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Western</th>
<td className="ggds-table__numeric">1020</td>
<td><meter className="ggds-meter" min="0" max="1100" value="1020" aria-hidden="true">1020 mm</meter></td>
<td className="ggds-table__numeric">880</td>
</tr>
<tr>
<th scope="row">Volta</th>
<td className="ggds-table__numeric">812</td>
<td><meter className="ggds-meter" min="0" max="1100" value="812" aria-hidden="true">812 mm</meter></td>
<td className="ggds-table__numeric">700</td>
</tr>
<tr>
<th scope="row">Ashanti</th>
<td className="ggds-table__numeric">744</td>
<td><meter className="ggds-meter" min="0" max="1100" value="744" aria-hidden="true">744 mm</meter></td>
<td className="ggds-table__numeric">770</td>
</tr>
<tr>
<th scope="row">Greater Accra</th>
<td className="ggds-table__numeric">512</td>
<td><meter className="ggds-meter" min="0" max="1100" value="512" aria-hidden="true">512 mm</meter></td>
<td className="ggds-table__numeric">430</td>
</tr>
</tbody>
</table>
</div>
<p className="ggds-hint">Example figures only.</p>
</>Use it
- Stylesheet
ggds.cssincludes it. To load only the parts you use:core.css, thencomponents/meter.css(0.3 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 { Meter } from '@ggds/react';
<td className="ggds-table__numeric">812</td>
<td><Meter value={812} max={1100} /></td>Django
With ggds-django ({% load ggds %}):
{% ggds_meter region.rainfall max=1100 %}Classes and states
| Class | What it does |
|---|---|
.ggds-meter | The bar: a native <meter> with min, max and value, in the institution’s colour. |
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 | New: meter, an amount as a bar in a table, so a table is also a chart; a native <meter>, hidden from screen readers because the number is next to it. |
| 0.1.0 | Added. |
Related components
Something wrong, unclear or missing? or suggest a change to it on GitHub. You need a GitHub account.