Status indicator
A dot for the glance, words for the meaning. Colour is never the only signal.
Show code
<p class="sn-state" data-state="open"><i aria-hidden="true"></i>Taking on new projects from November</p> When to use it
- One of a few states that changes now and then: taking on work, one slot left, fully booked.
- The state can be said in a few words beside the dot.
Use something else when:
- It is about the page or something the person did: a notice.
- It is how far something has got: a progress bar.
- It labels what a thing is, not how it stands: a tag.
How it works
The class is .sn-state, with data-state set to open, limited or full: a dot, then the words.
| State | Token | Contrast |
|---|---|---|
| Open | color.status.open | 3:1 or more as a graphic in both themes |
| Limited | color.status.limited | 3.2:1 on cream: the tightest pass in the system, watched on every change |
| Full | color.status.full | 5:1 on cream |
The soft halo is the same colour at 22% opacity. It makes the dot easier to spot without changing its contrast.
Do and don't
Do
- Say the state in words every time
- Keep to the three states
Don't
- Show the dot alone
- Make the dot move: it draws the eye for as long as the page is open
Accessibility
What it does for you
- The words say the state. The dot is decoration, hidden from screen readers.
- Each dot has at least 3:1 against the page, in light and dark.
- The dot does not move.
- It is text: nothing in it is a stop for the keyboard.
What you need to do
- Words that say the state outright: "Fully booked until January".
- Never the dot alone.
- The right element round it: a paragraph, or a list item.
Keyboard
| Key | What it does |
|---|---|
| Tab | Nothing: it is text. |
What a screen reader is told
- The words, as ordinary text. Nothing about the dot.
This is what the browser reports to assistive technology. What each screen reader then says varies, and has not been listened to yet.
WCAG 2.2
| Criterion | Level | How this meets it |
|---|---|---|
| 1.4.1 Use of Color | A | The state is in words; the colour only repeats it. |
| 1.4.11 Non-text Contrast | AA | Each dot against the page. |
| 2.2.2 Pause, Stop, Hide | A | Nothing moves. |
The criteria this component has a part in. A page that uses it still has to meet the rest.
Checked
| Check | How | Result |
|---|---|---|
| Automated (axe-core) | WCAG 2.0, 2.1 and 2.2 rules at A and AA, the page in light and in dark | Passed Nothing found, light or dark |
| Narrow screen | No sideways scrolling at 320px wide (WCAG 1.4.10) | Passed No sideways scrolling |
| Keyboard and what the browser reports | Real key presses on the live example, and the role, name and state given to assistive technology | Passed 5 of 5 checks pass |
| On paper | Somnia’s print check: no overlaps, stranded headings or controls on the page | Passed No faults on 4 sheets |
| Screen reader | Listened to by a person, in VoiceOver and NVDA | Not yet Not yet checked by a person |
The 5 checks made with the keyboard, on the example at the top of this page:
- Passed The words say the state, as ordinary text
- Passed The dot is hidden from screen readers
- Passed Each dot is drawn, 10px across, in its own colour
- Passed Each dot has at least 3:1 against the page, in light and dark
- Passed The dot does not move, and nothing in it is a stop for the keyboard
Run by script on against Somnia DS 1.89.0, in Chromium with axe-core 4.14.0. How these checks work, and every component's results.
Not yet checked
- How it sounds in a screen reader (VoiceOver, NVDA, TalkBack) has not been checked by a person. The roles, names and states the browser reports are checked by script; what is actually spoken is not.
- Windows high contrast (forced colours) has not been looked at by a person.
- The three dots differ by colour alone. That is safe only because the words are always there; a row of dots without words would fail people who can’t tell the colours apart.
Evidence
Where it's used
| Where | For |
|---|---|
| Nowhere yet as this class | Until 1.87.0 it was drawn only in these docs. Somnia CMS’s menu dots and these docs’ own status marks follow the same rule, a shape and a colour with words, in their own styles. |
What we saw, and what changed
| When | What we saw | What changed |
|---|---|---|
| Somnia CMS’s menu needed to show a change waiting, going live and live. Three colours alone would not do. | Each state has its own shape as well as its colour, and its words (Round G, 1.75.0). | |
| Writing this page’s checks: the code this page told people to write used a class that was styled nowhere but in these docs, so on a site it would have drawn nothing. | A real class in Somnia’s shared styles, .sn-state, for every site (1.87.0). |
From building and using it on real sites, each entry taken from the changelog or the build's own notes. This is observation by the studio and its clients, not research sessions with users.
What we don't know yet
- No site uses it yet, so nothing is known about it in use.