Issue 01 · Content · p.23
Badges
Compact status labels in neutral, accent and semantic tones.
Why it works: Badges label things; they are not buttons. Keep text to one or two words.
Try it:
Receipt: axe clean · contrast 4.79:1 · 0 tab stops · RTL ✓ · long text ✓
- PASS axe, WCAG 2.1 A and AA: no violations in light or dark (7 rules passed).
- PASS Tightest text contrast 4.79:1, where 4.5:1 is needed (light).
- PASS Still passes contrast with tokens fitted to a yellow brand colour.
- PASS Right-to-left with Arabic sample text fits a 390px phone.
- PASS Every string 40% longer still fits a 390px phone.
- PASS No motion.
Tab order: nothing here takes focus (it is content, not controls).
What assistive tech is given
- text: Draft New Active Pending Failed
Automated checks in CI (axe in Chromium, reduced motion on). They catch a lot, not everything: still try it with a screen reader.
See it in the zine npx -y tearsheet add badges
Needs the shared tokens.css once per project.
HTML + CSS
index.html
<!-- tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html -->
<div class="badges">
<span class="badge">Draft</span>
<span class="badge badge-accent">New</span>
<span class="badge badge-success"><span class="badge-dot" aria-hidden="true"></span>Active</span>
<span class="badge badge-warning">Pending</span>
<span class="badge badge-danger">Failed</span>
</div>styles.css
/* tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
--tone: var(--ui-muted);
--tone-soft: var(--ui-surface-2);
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
font-size: 12px;
font-weight: 600;
line-height: 1.4;
color: var(--tone);
background: var(--tone-soft);
border-radius: 999px;
}
.badge-accent { --tone: var(--ui-accent); --tone-soft: var(--ui-accent-soft); }
.badge-success { --tone: var(--ui-success); --tone-soft: var(--ui-success-soft); }
.badge-warning { --tone: var(--ui-warning); --tone-soft: var(--ui-warning-soft); }
.badge-danger { --tone: var(--ui-danger); --tone-soft: var(--ui-danger-soft); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }React
Badges.jsx
/* tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html */
import './Badges.css';
export function Badges() {
return (
<div className="badges">
<span className="badge">Draft</span>
<span className="badge badge-accent">New</span>
<span className="badge badge-success"><span className="badge-dot" aria-hidden="true"></span>Active</span>
<span className="badge badge-warning">Pending</span>
<span className="badge badge-danger">Failed</span>
</div>
);
}Badges.css
/* tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
--tone: var(--ui-muted);
--tone-soft: var(--ui-surface-2);
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
font-size: 12px;
font-weight: 600;
line-height: 1.4;
color: var(--tone);
background: var(--tone-soft);
border-radius: 999px;
}
.badge-accent { --tone: var(--ui-accent); --tone-soft: var(--ui-accent-soft); }
.badge-success { --tone: var(--ui-success); --tone-soft: var(--ui-success-soft); }
.badge-warning { --tone: var(--ui-warning); --tone-soft: var(--ui-warning-soft); }
.badge-danger { --tone: var(--ui-danger); --tone-soft: var(--ui-danger-soft); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }Vue
Badges.vue
<!-- tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html -->
<template>
<div class="badges">
<span class="badge">Draft</span>
<span class="badge badge-accent">New</span>
<span class="badge badge-success"><span class="badge-dot" aria-hidden="true"></span>Active</span>
<span class="badge badge-warning">Pending</span>
<span class="badge badge-danger">Failed</span>
</div>
</template>
<style scoped>
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
--tone: var(--ui-muted);
--tone-soft: var(--ui-surface-2);
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
font-size: 12px;
font-weight: 600;
line-height: 1.4;
color: var(--tone);
background: var(--tone-soft);
border-radius: 999px;
}
.badge-accent { --tone: var(--ui-accent); --tone-soft: var(--ui-accent-soft); }
.badge-success { --tone: var(--ui-success); --tone-soft: var(--ui-success-soft); }
.badge-warning { --tone: var(--ui-warning); --tone-soft: var(--ui-warning-soft); }
.badge-danger { --tone: var(--ui-danger); --tone-soft: var(--ui-danger-soft); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
</style>Svelte
Badges.svelte
<!-- tearsheet badges vdb6d9bde · https://qusaialjbali.github.io/tearsheet/zine/parts/badges.html -->
<div class="badges">
<span class="badge">Draft</span>
<span class="badge badge-accent">New</span>
<span class="badge badge-success"><span class="badge-dot" aria-hidden="true"></span>Active</span>
<span class="badge badge-warning">Pending</span>
<span class="badge badge-danger">Failed</span>
</div>
<style>
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
--tone: var(--ui-muted);
--tone-soft: var(--ui-surface-2);
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
font-size: 12px;
font-weight: 600;
line-height: 1.4;
color: var(--tone);
background: var(--tone-soft);
border-radius: 999px;
}
.badge-accent { --tone: var(--ui-accent); --tone-soft: var(--ui-accent-soft); }
.badge-success { --tone: var(--ui-success); --tone-soft: var(--ui-success-soft); }
.badge-warning { --tone: var(--ui-warning); --tone-soft: var(--ui-warning-soft); }
.badge-danger { --tone: var(--ui-danger); --tone-soft: var(--ui-danger-soft); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
</style>