Design system · P2
Fifteen primitives, one token layer
Every component on this page reads its colour, spacing, radius and motion from
resources/css/tokens.css. There is no raw colour in a component file — a test enforces
that, because a component with its own palette is a theme you cannot change.
02 · Input
Form controls
Each control owns its label, hint and error wiring: for/id,
aria-describedby and aria-invalid are generated, not remembered.
Input
As it appears on the invoice.
Enter a valid email address.
Select, textarea and checkbox
Proration follows the selected cycle.
Visible to staff only.
Only for EU business customers.
03 · Feedback
Badge, alert, skeleton, empty state
Badges
Scheduled maintenance
Payment recorded
Provisioning is taking longer than expected
Gateway rejected the refund
Skeleton (loading)
Empty
No invoices yet
When a customer's first order is paid, its invoice will appear here with a permanent number.
04 · Structure
Card, table, tabs, pagination, breadcrumb
Invoice INV-2026-0042
Issued 2026-11-04 · due 2026-11-18
| Description | Qty | Unit | Total |
|---|---|---|---|
| Business hosting · annual | 1 | $120.00 | $120.00 |
| Domain · .com renewal | 1 | $14.50 | $14.50 |
| Priority support · monthly | 3 | $9.00 | $27.00 |
Narrow screens turn each row into a card; the column name comes from data-label.
Pagination
05 · Overlay
Modal
A native <dialog>: focus trapping, Escape and the top layer are the browser's job.
JavaScript only wires the two buttons, so the page degrades to "nothing opens" rather than breaking.
06 · Foundation
Tokens
Semantic colours are tuned to clear WCAG AA as small text on both surfaces, in light and dark mode. Changing the theme rewrites these variables only.
Surface
--bg
Surface subtle
--bg-subtle
Surface inset
--bg-inset
Border
--border
Brand solid
--c-brand-solid
Focus ring
--c-brand-500
Success
--c-success
Warning
--c-warning
Danger
--c-danger
Info
--c-info
Type scale
4xl · page title
2xl · section
lg · lead paragraph
base · body copy
sm · supporting copy and controls
xs · metadata
Shape and depth
07 · Behaviour
The six states every screen must answer
Not "add a spinner": each state names what the user sees, what they can do, and which primitive carries it.
Empty
Say what would appear here and offer the one action that creates it.
empty-state
Loading
Skeleton blocks in the shape of the eventual content — never a full-screen spinner.
skeleton
Error
Name the failed operation, say whether money moved, offer a retry. No stack traces.
alert
No permission
Explain the missing role and who can grant it; do not hide the screen silently.
alert
Over limit
Show the limit, the current count and the path to raise it before the action fails.
badge + alert
Conflict
Two writers, one row: show both versions, let the user pick, never auto-merge money.
alert