Standard
A plain label. The words carry the meaning.
A compact label that shows the status of an item, tags content with a category, or shows a count. People can remove a dismissible badge, like a filter they applied.
Updated
Badge
Paste this markup beside the item the badge describes
<span class="nds-badge nds-badge--standard nds-badge--success"> <span class="nds-badge__label"> Approved </span></span> Usage
<!-- wp:nds/badge {} --><span class="nds-badge nds-badge--standard nds-badge--success"> <span class="nds-badge__label"> Approved </span></span><!-- /wp:nds/badge --> Usage
import { Badge } from "@nigerian-design-standards/react";<Badge label="Approved" variant="success"/> Usage
use NDS\Components\Badge;echo Badge::render([ 'label' => 'Approved', 'variant' => 'success',]); Use a badge to label an item with its status or category, to show a count, or to show a filter people can remove. The words carry the meaning, and the colour backs them up.
Type changes how the badge is built; variant changes the colour. Every type comes in neutral, info, success, warning and error.
A plain label. The words carry the meaning.
A close button removes it. The only type people interact with.
A number only. Say what is counted in nearby text.
A leading icon adds shape as a second cue, for statuses people mustn’t miss.
The properties of the badge. The same in HTML, WordPress and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| label | string |
| Required. One or two words, in sentence case. |
| type | string |
| Dismissible adds a remove button. |
| variant | string |
| Same variant for the same status everywhere. |
| icon | boolean |
| Adds a 24px leading icon. Not on numeric badges. |
In code, standard and numeric badges are a plain <span> and are not focusable.
Dismissible adds a <button type="button"> with an aria-label that names what it removes, like aria-label="Remove Lagos filter". For numeric badges, include visually
hidden text that says what is counted.
| Part | Token | Contrast on the page |
|---|---|---|
| Container | status/{variant}/bg · status/{variant}/border 1px · radius/050 4px · spacing/050 4px | Border is decorative |
| Label | Label/small · status/{variant}/surface | 4.65:1 to 6.41:1 |
| Neutral | action/tertiary/default · text/secondary · action/tertiary/border | 6.4:1 |
| Close icon | icon/Close Small, 16px in a 24px target, in the label colour | 4.65:1 or more |
| Warning | status/warning/bg · color/yellow/700 (primitive) | 4.75:1 |
| Leading icon | icon/Info Small, 16px, in the label colour | 4.75:1 on warning/bg |
Use words that say the status, and the same variant for the same status everywhere.
Don’t use a badge as a button or for a sentence. Use a button, link or alert.
How badges sit beside content and how much room they take.
How to write badge labels.
Pick “Approved” or “Accepted”, not both.
Say what is counted in nearby text.
The remove button says “Remove Lagos filter”.
| Write | Don’t write | Why |
|---|---|---|
| Pending review | A colour with no words | Say the status. |
| Approved | PENDING REVIEW | Sentence case. |
| Remove Lagos filter | Remove | Name what it removes. |
| 3 | 3 unread | Counts are numbers only. |
| Accepted | Approved and Accepted for the same status | Same word, same status. |
Badges are mostly text. Only dismissible badges are interactive controls.
| Key | What it does |
|---|---|
| Tab | Moves to the remove button on a dismissible badge. Standard and numeric badges aren’t focusable. |
| Shift + Tab | Moves back. |
| Enter or Space | Removes the badge. Focus moves to the next badge, or to the filter area if it was the last. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use Badge from 01 Library – Foundations. Pick the type and variant, and keep labels to one or two words.
Is this page useful?