Component specWhat badge.js draws

The badge

A small pill that sits inside someone else's blog. It has a light and a dark set of colours and picks one from the page it is on, and has one accent colour you can set. Every state below is the same component. This page draws it in the site's own font; badge.js uses the system font.

Try it Tab to focus · Space/Enter toggles · ← → skip 10 s

States

Each panel: desktop (40 px) then touch (44 px, on touch screens; the voice label is hidden below a 480 px viewport).

Anatomy and measurements

Keyboard and ARIA

Design tokens

Defined as CSS variables in tokens.css for [data-theme="day"] and [data-theme="night"], with prefers-color-scheme as the default.

Colour
Type scale
DisplayNewsreader 600 · 42–86 · lh .96
SectionNewsreader 600 · 36–64 · lh 1
Article bodyNewsreader 400 · 19 · lh 1.6
InterfaceGeist 400–600 · 13–17
LABEL · CODEGeist Mono 400–600 · 10.5–13.5
Spacing
Radii
2 · blocks
8 · terminal
999 · pill
50% · button