Design system
OpenTodo's interface follows the "Precision" direction: dense, near-monochrome and dark first, with the emerald accent as the only colour that isn't state. A flat cool slate canvas holds one inset content surface; rows are one line, hairlines separate instead of boxes, and colour appears only where it means something (late, a deadline, now, done, the primary action). Dark surfaces separate by lightness, a step at a time. Every colour, size, radius, shadow and duration comes from a design token, and every shared building block is developed and checked in a workbench. The contract lives in the design-system OpenSpec capability; this page is the how-to. How a screen is put together (the page template, the panel, settings, rows and the interface budget) is in the Interface guide.
On this page
Principles#
- Content first. Chrome is neutral, and colour is reserved for meaning: priority, project and label colours, status.
- Dense, not noisy. Compact rows and small precise type; calm comes from restraint, not space.
- One way to do a thing. Every control comes from a primitive and every value from a token.
- Accessible by construction. AA contrast, a visible focus ring, 44 px touch targets and reduced motion are enforced by tests, not left to review. A phrase for screen readers ("3 comments" for a chip showing "3") is visually hidden text inside the element (
ReadAsinweb/src/ui/Chips.tsx), never anaria-labelon aspanordivwithout a role, which screen readers ignore;npm run lintrefuses that. - Calm motion. Short transitions, nothing bouncing in the way.
| Keep (identity) | Evolve (craft) | |
|---|---|---|
| Colour | emerald accent, slate neutrals | a flatter, darker slate; colour only for state; the sidebar on the canvas |
| Mood | calm, honest, a little technical | precise, quiet, fast |
| Space | 4 px grid, 36 px rows (44 px on touch), 32 px lines in the task panel (44 px on touch), 16/24 px section gaps | |
| Surfaces | one inset content surface, hairlines, flat cards; shadows only on overlays | |
| Type | bundled Inter, 13 px list text (one token), 15 px prose, clear heading scale | |
| Delight | gentle motion and a satisfying completion state, respecting reduced motion |
Tokens#
Tokens are defined once in web/src/index.css:
- Raw values are
--ot-*custom properties: light on:root, dark underprefers-color-scheme: darkand again under[data-theme="dark"]. The two dark blocks must stay identical (a unit test checks it). The app follows the system preference; the workbench setsdata-themeto show both themes, also side by side. @theme inlinemaps them to Tailwind utilities that resolve per element, so a[data-theme]subtree switches too.- The
dark:variant uses the same two conditions.
| Group | Utilities | Notes |
|---|---|---|
| Surfaces | bg-canvas, bg-surface, bg-raised, bg-sunken, bg-pop, bg-hover, bg-selected, bg-selected-row |
window and sidebar, the inset content surface, group bars and inputs, wells and board columns, popovers and menus, hover, the selected nav item or active tool, a selected row |
| Text | text-strong, text-default, text-muted, text-faint, text-accent, text-on-accent |
the four tones; each meets 4.5:1 on every surface it is allowed on |
| Borders | border-default, border-soft, border-input, border-strong |
a container edge, a softer divider, a control edge (3:1), a popover or selected-card edge; the first two stay at 1.1:1 or more on every surface |
| Accent | bg-accent, bg-accent-hover, bg-accent-soft, text-on-accent-soft, ring-focus, outline-focus |
emerald-700; focus ring 2 px with offset |
| Priority | border-p1 … border-p4, bg-p1-soft … bg-p4-soft |
red, orange, blue, slate |
| Status | text-success, bg-warning-soft, text-on-danger-soft, … |
success, warning, danger, info, each with a soft step |
| Palette | bg-hue-solid, bg-hue-soft, text-hue under data-hue="<name>" |
12 hues for projects and labels |
| Type | text-hint, text-meta, text-body, text-prose, text-h3, text-title, text-h2, text-h1, text-display |
11.5 (weight 500), 12.5, 13, 15, 14, 16 (the docked task panel's title), 20, 22, 28 px; rem-based. text-body is the list and control step, one token (--ot-text-list): set it to 0.875rem for 14 px. text-prose is for running text (notes, help, the briefing). Headings are weight 600, the display step 650, with tracking −0.01em (h2), −0.015em (h1) and −0.025em (display) |
| Radius | rounded-chip, rounded-control, rounded-card, rounded-surface, rounded-popover |
6 (rows, chips), 7, 8, 10 (the inset surface), 12 px |
| Elevation | shadow-1, shadow-2, shadow-3 |
shadow-1 is no shadow (lists and cards are flat); popovers and dialogs keep shadow-2 and shadow-3 |
| Motion | duration-(--duration-ui), duration-(--duration-emphasis), duration-(--duration-moment), ease-calm, ease-spring |
Three durations: 120 ms for interface feedback, 250 ms for emphasis and the 400 ms moment, reserved for the completion sequence, list reflow and overlay entrances; nothing lasts longer and an exit takes about three quarters of its entrance. ease-spring is an ease-out that settles without overshoot (nothing bounces). Opening a task's page or Settings slides the page by 30% over the emphasis duration: in from the end edge going deeper, out to it going back; a switch between list views changes at once; the sidebar and the bars stay still (app/pageTransition.ts, :root[data-nav] in index.css). Reduced motion keeps only colour and opacity fades of at most 120 ms and skips view transitions; data-motion="none" zeroes all three, so everything is instant |
Rules for code under web/src/ui/:
- Use token utilities only, in shared components, screens (
web/src/app) and the component classes ofindex.css. A raw palette class (bg-slate-200), a fixedbg-white/text-black, a hex literal or a literal colour function (rgb(148 163 184 / 0.35),hsl(),oklch();color-mix()over tokens is fine) failssrc/ui/tokens/lint.test.ts, which names the file and line. A hex passed ascolor=is stored data and allowed. Screens that an open change is rewriting sit on the lint's named allow-list, which may only shrink. - Choose a token by what the colour means, not by its hue today. Emerald is both the accent and the success colour, and only the meaning keeps them apart when a theme changes the accent:
| Meaning | Tokens |
|---|---|
| Content surface, card, panel, input background | bg-surface |
| Window and sidebar background | bg-canvas |
| Group bar, raised card, composer | bg-raised |
| Well, board column | bg-sunken |
| Popover, menu, tooltip, sheet, palette | bg-pop with border-strong |
| Hover tint (rows, nav, buttons) | bg-hover |
| Selected nav item, active tab or tool | bg-selected (never with text-faint) |
| Selected row | bg-selected-row |
| Body text, headings | text-default, text-strong |
| Secondary text | text-muted |
| Hints, placeholders | text-faint, placeholder-faint |
| Card and container edges, dividers between groups, input borders | border-default, border-soft, border-input |
| Actions, links, selection, focus, current navigation | bg-accent, text-accent, bg-accent-soft with text-on-accent-soft, ring-focus, text-on-accent on the accent |
| Done, saved, connected | text-success, bg-success-soft with text-on-success-soft |
| Errors, destructive actions | text-danger, border-danger, bg-danger-soft with text-on-danger-soft |
| Cautions | text-warning, bg-warning-soft with text-on-warning-soft |
| Neutral notices | text-info, bg-info-soft with text-on-info-soft |
| Task priority | p1 to p4 |
| Overlay scrim, search highlight | bg-scrim, bg-highlight |
A token switches between light and dark by itself, so a screen needs no dark: partner for colour.
- Before using a new foreground and background combination, add it to
src/ui/tokens/pairs.ts.contrast.test.tsrecomputes every pair fromindex.cssin both themes and every accent and fails with the pair, theme and ratio. - Tones, not opacity. To make text or an icon quieter, step down one tone:
text-strong,text-default,text-muted,text-faint. An icon takes the tone of its text (currentColor). Anopacity-*utility or an alpha suffix (text-default/70,border-soft/50) on text or a border fails the lint; show and hide (opacity-0,opacity-100) and disabled states are fine, and a dragged ghost, a fading row or the scrim carrytone-lint-allowon the line with the reason. Every number (a time, a count, a duration) goes through a primitive that setstabular-nums.
Colour in OKLCH#
Every colour token is written in OKLCH: an oklch(L C H) literal inside the sRGB gamut, or a color-mix() over other tokens. A hex, rgb(), hsl() or named colour inside a token block fails the lint with the stylesheet line. The browser resolves everything; the tests resolve the same values with src/ui/tokens/resolve.ts (OKLCH, mixes and alpha composited over the real surface) and measure what is drawn.
- Neutrals are a flat cool slate with low chroma, the same in every theme (precision-tokens D1). Light: canvas
oklch(0.9542 0.0034 248), surface and popover white, raisedoklch(0.9757 0 0). Dark: canvasoklch(0.1635 0.0045 264), surfaceoklch(0.1959 0.0062 271), raisedoklch(0.2184 0.0079 275), popoveroklch(0.2271 0.0079 275), selectedoklch(0.2728 0.0097 268). Borders are opaque hairlines a step from the surface. The sidebar sits on the canvas: the old accent tint is retired. - An accent theme declares three values in its
[data-accent]block:--ot-al-accent(the light accent, also the browser bar colour),--ot-ad-accent-text(the bright accent for dark text, focus and the chart) and--ot-a-on-accent(text on the accent). Hover, soft, soft text and focus derive from them. A derived step that misses its minimum may be overridden in the accent block next to a comment naming the pair;theme.test.tscounts the overrides (today one: graphite's dark buttons). - A custom accent (OpenSpec
accent-colour) has no block:src/lib/accentDerive.tsderives the same three values (and a dark button when the light accent is too dark on the dark canvas) from the colour a person picked, andapplyAppearancesets them as inline properties on<html>withdata-accent="custom", so the mixes below do the rest and the high-contrast override still wins. The derivation keeps the picked OKLCH hue, clamps chroma to sRGB and moves only the lightness, to the nearest value at which every pair ofpairs.tswith an accent-derived token passes in that mode, each value rounded to the#rrggbbthat is applied; it also turns the hue away from the danger and priority-1 colours until it is at least as far from them as Rose is (RED_GUARD). Its copy of the mode tokens and ratios is checked againstindex.css;contrast.test.tssweeps 432 picked colours plus greys through the real resolver, andaccent.vectors.jsonpins exact outputs. A change to a ratio or a pair is measured on custom accents too. - A palette hue declares one solid per mode; its soft and text steps derive.
- The ratios are
--ot-mix-*custom properties in the:rootblock, read back by the tests:
| Step | Light | Dark |
|---|---|---|
| Accent hover | 86 % accent toward black | same |
| Accent soft | 10 % accent into the surface | 14 % bright accent into the surface |
| Accent soft text | 80 % accent toward black | 80 % bright accent toward white |
| Focus | 85 % accent toward white | the bright accent |
| Hue soft | 14 % solid into the surface | 22 % solid into the canvas |
| Hue text | 68 % solid toward black | 78 % solid toward white |
Steps toward black or white mix in oklch, which keeps the hue; steps into a surface mix in oklab, because the dark surfaces are slightly blue and an OKLCH mix would turn the hue toward them. A browser without OKLCH gets six plain surface and text values from an @supports fallback: readable, not themed.
Themes#
A theme (OpenSpec themes, Themes) sets every semantic token at once from a JSON document of a few seeds. index.css stays the source of OpenTodo's own tokens: OpenTodo Light and Dark are generated from it as documents (node scripts/themes-sync.mjs, checked by web/src/lib/theme/themes.test.ts) and choosing them writes nothing extra. Another theme is derived on the device (web/src/lib/theme/derive.ts, every token starting from OpenTodo's value carried onto the seeds, then moved in lightness only as far as its pairs need) and applied as one rule, html:root[data-ot-theme]:not([data-contrast="high"]), which outranks every mode and accent block and never matches under high contrast; the radius steps (--ot-radius-*), --ot-font and --ot-text-list sit in a second rule that does. public/appearance.js writes the same rule from the device cache before the first paint. contrast.test.ts measures every theme document in web/src/lib/theme/builtin/ and a sweep of 200 seed-only themes through the resolver, and checkTheme (check.ts) is the same measurement at run time. A new token needs a reference value in the stylesheet: run the sync script so the derivation and the documents know it.
High contrast and no motion#
Two root attributes change the presentation for screens that ask for them (OpenSpec display-mode, design-system "High-contrast and no-motion presentation"):
data-contrast="high"on<html>overrides the--ot-*tokens: every surface is pure white (light) or pure black (dark), text is black or white with secondary text still at 7:1 or more, soft tints become the surface (an outline keeps their shape), borders and the focus ring are full black or white, and the priority and status hues are darkened (light) or lightened (dark) to 7:1 as text and 3:1 as marks. The blocks arehtml:root[data-contrast="high"], the system-dark branch and[data-theme="dark"]; their selectors outrank the mode and accent blocks, so the override combines with any mode and accent. The two dark blocks must stay identical.data-motion="none"sets--duration-ui,--duration-emphasisand--duration-momentto0msand makes every transition and animation instant, stricter than the reduced-motion query (colour and opacity do not fade either).
Only the display routes set them, on mount, and remove them on unmount (useRootPresentation in web/src/app/display/displayHooks.ts); they never touch the user's theme or preferences. OVERRIDE_PAIRS in src/ui/tokens/pairs.ts holds the override's pairs with raised minimums (7:1 for text and chips, 3:1 for the rest), and contrast.test.ts measures them in both modes and names the pair, the override and the ratio when one fails. The workbench shows the override in Foundations → Colours → High Contrast Override. The display's large type is not a token: .display-root multiplies the type tokens by --display-scale (1.35, 1.6 and 2.15 for the m, l and xl sizes), so it still follows the browser's font size.
The legacy classes .btn-*, .input and .kbd are gone: screens use <Button>, <IconButton>, the field primitives and <Kbd> (or the ui-btn, ui-input and ui-kbd classes they render), and lint.test.ts fails if a legacy class returns to the stylesheet or a screen.
Stored colours#
Projects, labels and views store a free hex string in their ops. At render time hueFor() in web/src/ui/tokens/palette.ts maps it to a palette hue: an exact canonical hex maps to itself, a grey (OKLCh chroma below 0.06) maps to slate, and anything else maps to the hue with the nearest hue angle. Components render data-hue="<name>" and use bg-hue-soft text-hue. Rendering never writes the stored value back; a colour picked in the UI stores the hue's canonical hex (LABEL_PALETTE).
Typeface#
Inter 4.1 is bundled as web/src/assets/fonts/InterVariable-latin.woff2 (84 KB, weight and optical-size axes, Latin subset, licence in OFL.txt). font-optical-sizing: auto lets text at the display size use Inter's Display cut. It is served from the app's own origin, hashed by Vite and precached by the service worker; no font is ever requested from another host. The family is named OpenTodo Inter, so a locally installed Inter is never used instead, and font-display: swap shows the system font until it loads.
To regenerate it (fonttools 4.60.1):
python3 -m venv venv && ./venv/bin/pip install fonttools==4.60.1 brotli==1.1.0
curl -LO https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip && unzip Inter-4.1.zip
./venv/bin/pyftsubset InterVariable.ttf \
--unicodes="U+0000-00FF,U+0100-017F,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20A0-20CF,U+2122,U+2190-21FF,U+2212,U+2215,U+FEFF,U+FFFD" \
--layout-features='kern,liga,calt,ccmp,locl,mark,mkmk,tnum,cv11' \
--flavor=woff2 --output-file=InterVariable-latin.woff2
Keep the unicode-range of the @font-face rule in index.css in step with --unicodes.
Building blocks#
Screens import shared UI from web/src/ui/ (re-exported from web/src/ui/index.ts); they don't hand-build buttons, menus or pickers.
Quick add field#
The quick add's line field (list pages, the Inbox catch, first run, capture) is drawn on a filled surface with the .quick-add-surface class in web/src/index.css: the sunken token, a resting border-soft hairline (the dark fill alone is about 1.03:1 on the surface), the control radius, compact padding and, while the input has focus, the focus border with its ring. The high-contrast presentation, where the surface tokens are one colour, gives it the default border instead. The command bar and the phone sheet keep their own frames. The list page's sticky row has no divider under it.
Icons#
One line-icon set, vendored from Lucide (ISC licence in web/src/ui/icons/LICENSE-lucide.txt); there is no icon dependency at runtime. Use <Icon name="bell" />: it draws in the current text colour and is hidden from assistive technology. Give it a label only when the icon itself carries meaning; an icon-only control gets its name from the control (see IconButton).
Emoji and Unicode symbols are not icons: make check runs scripts/ui-check.mjs, which fails on a glyph used as an icon in web/src/app (typography inside copy, such as "Settings → Integrations", is fine).
To add an icon, add its Lucide name to web/src/ui/icons/names.json and regenerate:
npm pack [email protected] && tar xzf lucide-static-1.48.0.tgz
node scripts/icons-sync.mjs ./package
The script is idempotent. A unit test fails when a vendored icon is used nowhere (or listed as reserved for a planned screen change), so the set doesn't grow unnoticed.
Brand#
The mark is an open tray whose two upper ends turn inward, with a tick dropping into its opening. It is drawn as two strokes on a 24-unit grid with a 2-unit stroke and round caps and joins: the tray M6 11.5 4.5 13v4.5a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V13L18 11.5 and the tick m8 8 4 4 7.5-7.5, centred on (12, 12). The tick stays within the tray's width, and the lips keep a visible gap of 1.89 units to it (the same as the tray's sides), so the two never touch at 16 px. It is never a tick inside a closed square or a checkbox, and the wordmark is never part of it.
- Source:
web/src/ui/icons/brand.svg, under 2 KB, two symbols:monoandcolour. Every other brand file is generated from it. - In the interface:
<BrandMark size={24} />(sizes 16, 20, 24, 32) drawsmono: the tray incurrentColorand the tick in--ot-accent-text, so it takes the tone of its row and the theme's accent.<BrandWordmark />is the text "OpenTodo" in the strong tone, set in the bundled Inter; it is never translated. Both come from theuibarrel; no screen uses an image of the icon. - Elsewhere:
colouris a white tray and an emerald tick on a slate rounded square, the same in every theme, because it sits on other people's surfaces: the favicon, the manifest icons (192 and 512 px, a 512 px maskable icon that fills its square), the Apple touch icon, the browser extension's icons, the deploy catalogues' logos and icons (Runtipi's JPEG logo, the Home Assistant add-on's icon and its 250 × 100 logo, the Claude plugin's icon among them) andbrand/in the site bundle. A test fails on any file named like an icon or a logo underweb/public,extension,obsidian,mobile,deployordocs/screenshotsthat the script does not write. - Native shells: the iOS app icon (
AppIcon.png, 1024 px, opaque, as the App Store requires) and the Android adaptive launcher icon (slate background, the colour strokes in the 66 dp safe zone, and a monochrome layer for themed icons) and notification icon (the mark as a white silhouette) are generated from the same source, the Android ones as vector drawables written from its path data. - Wordmark source:
web/src/ui/icons/wordmark.svgis "OpenTodo" in Inter 4.0 SemiBold as one outlined path on the mark's 24-unit height, for files opened without Inter. In the interface the wordmark stays live text (<BrandWordmark />). - Brand kit: the top-level
brand/folder holds the logo for use outside the code: the mark on light and dark backgrounds and in one colour, the colour icon (rounded and square) at 16 to 1024 px, the lockup with the outlined wordmark, an avatar, the GitHub social preview, a default social card (the docs pages' social image on the website) and Google Play's feature graphic, each listed with its use inbrand/README.md. It is generated with everything else (scripts/brand-kit.mjs), and a test fails on a file added or edited there by hand. - Regenerating:
make brand-icons(scripts/brand-icons.mjs) renders every raster in the Chromium that Playwright brings, with no image dependency, writes the Android drawables as text, and writesweb/src/ui/icons/brand-icons.jsonwith the hash of the source and of each file.scripts/brand-icons.test.mjs(inmake repo-checkandmake test-extension) fails when the source changed without regenerating or a generated file was edited by hand.
The Foundations/Brand story shows the mono mark at every size beside a row's checkbox in two accent themes; its 16 px baseline is the legibility check.
Illustrations#
Empty and finished states may show one calm line drawing above their sentence (the first is Inbox zero). Each lives in its own file in web/src/ui/illustrations/ as inline SVG and follows one style, so later ones match:
- one stage for all: 160 × 120 px, the illustrations' own open loop in the fine line (centre 80, 54, radius 40, its opening at the upper right; it is not the brand mark), drawn first so the object hides it, and one ground line
M40 100h80with short dashes at its ends; - two stroke weights in
currentColor(the wrapper sets the muted text colour): the main line1.75for the object and the fine line1for the loop, details, steam, rays and trails; round caps and joins; - the object filled with the surface (
var(--color-surface)), so it stands above the canvas in both themes; the sunken surface (var(--color-sunken)) only for ground shapes; - one accent shape, in or leaving through the loop's opening, filled
var(--color-accent)at 20 % and outlined invar(--text-color-accent)(the bright accent in the dark theme), the mark's tick escaping its loop; - no hex or
rgb()colours, gradients, filters, shadows, text, raster or external images, and no animation; - decorative: hidden from assistive technology, since the sentence beside it says everything;
- at most 4 KB per file.
The set, each a brief for the next drawing as much as a list:
| Name | Where | Motif | Accent shape |
|---|---|---|---|
inbox-zero |
Empty Inbox, end of Process the Inbox | An empty tray, a dashed trail rising from it | a paper plane leaving |
today-clear |
Empty Today | A mug from the side with three steam lines | the sun, with fine rays |
week-clear |
Empty Upcoming | A desk calendar with two rings and seven open days | a kite on a dashed string |
project-new |
A project with no open task | An open box, flaps out, a sprout growing from it | the sprout's leaf |
day-done |
Done for today (Close the day) | A closed notebook lying flat, page edges and its ribbon, two small stars | a crescent moon |
trash-empty |
Empty Trash | A bin with its lid on and its handle | a leaf drifting out |
No faces, people or mascots: each motif names the state in one glance and needs no translation of tone; a little character comes from objects (a paper plane, a kite, a sprout). Settings and error pages have no illustration. make ui-lint also refuses a third stroke width, a fill other than the surface, the sunken surface and the accent, and a second accent shape (illustrations-v2).
Name it in Illustration.tsx and pass that name to the empty-state pattern (<EmptyState illustration="inbox-zero" …/>); add it to Illustrations.stories.tsx so the workbench checks it in light and dark. make ui-lint fails on a file that breaks the colour, image, text or size rules.
Buttons#
<Button variant size icon iconEnd> with primary, secondary, ghost and danger, sizes sm (32 px), md (40 px) and lg (48 px). When onClick returns a promise, the button shows a spinner, sets aria-busy and ignores further clicks until it settles. <IconButton icon label> is the icon-only form; label is required and becomes the accessible name and the tooltip. The tooltip opens for a resting mouse and for focus a key moved, never for a tap, a click or the focus they leave on the button.
A button that only dismisses a sheet, popover, panel or mode says Close, never Done: next to a task, "Done" reads as "complete the task" (#801). The task panel, the facet editors (When, Assignee, Take turns, Labels), the selection bar and the Focus timer follow this. Done stays only where it confirms a choice or finishes an edit away from any task (a routine's picker, the accent picker, a project note, a secret shown once in Settings); next to a task, a button that confirms a choice says what it does (Apply, Save, Stop the timer).
Form controls#
Wrap a control in <Field label description error>: the label, the description and the error are wired to the control (aria-describedby, aria-invalid). Input, Textarea and Select are styled native elements; use Select for small fixed sets (role, sort order) and the Combobox for choosing an entity. A setting that applies immediately is a Switch (role="switch"): a 32 × 18 px track, accent when on, whose hit area grows to 44 px on a touch screen. A choice submitted with a form is a Checkbox (with an indeterminate state). One choice among two to six options is a RadioGroup (settings-foundation): cards when each option needs a sentence (bordered blocks, the chosen one in the accent with a check), list for short ones; native radios inside labels give the group semantics, the arrow keys and "2 of 3", and a disabled option says why in its reason. A screen never renders a raw type="radio" (make ui-lint fails on one under web/src/app). A number is a NumberInput: a text field with the numeric keyboard (never type="number", so the scroll wheel cannot change it), its unit after the value inside the field ("25 MB", "15 min"), the arrow keys stepping within min and max, the range as the error when a value is outside it ("Between 1 and 500 MB"), and an optional noLimit checkbox that clears and disables the field. A Select draws its own chevron, two gradients in the muted text colour, instead of the platform's arrow (precision-settings). On a touch screen (pointer: coarse) every text field, select and editable area, and the text inside an editable area, is at least 16 px, or Safari on iOS zooms in on focus (#724): the type steps under 16 px (text-hint, text-meta, text-body, text-prose, text-h3) read --ot-text-* variables, and the base layer sets those to at least 16 px on such elements, growing with the text size (max(16px, …), text-size D4), so a field styled with text-meta needs nothing more; a fixed font-size on a field would bypass it, and the layout check (smallFields in scripts/ux-audit/measure.mjs) fails on it. Never turn off zoom in the viewport tag (maximum-scale, user-scalable=no).
Menus#
Action menus use the overlay Menu with kind="menu" and contain MenuItem, MenuGroup and MenuSeparator. Items take an icon, a shortcut hint (shown and announced), a description (for example why an item is unavailable), danger (placed last, in its own group), disabled and checked for toggles. The menu opens on its first item; ↑/↓ wrap, Home/End jump, typing a letter moves to the next item starting with it, and choosing an item closes the menu and returns focus to its button. Panels that contain form controls keep kind="dialog".
Keyboard hints on touch devices. One rule in web/src/index.css hides every .ui-kbd badge and every element marked data-kbd-hint (a line that only names keys, or a separator that belongs to a badge) when the device has no fine pointer and nothing that hovers, until a hardware key press is seen (web/src/lib/keyboardSeen.ts sets data-keyboard on the root). Mark a new keys-only line with data-kbd-hint; do not hide it per component. data-kbd-keep exempts reference (the cheat sheet) and a key inside a sentence that would break without it (<Kbd> without only sets it). aria-keyshortcuts and descriptions stay in every case.
Focus on open on touch devices. On the same devices (touchOnly() in web/src/lib/keyboardLikely.ts) an overlay does not focus a text field as it opens unless the field asks for it, so the on-screen keyboard does not cover a picker's choices. A sheet for typing (quick add, a rename, a comment) asks with autoFocus or data-autofocus, as before. A picker's search or date field spreads pickerField() (from web/src/ui) instead, or uses <ComboboxPanel>, which does: it is focused where a key can be pressed and waits for a tap elsewhere. Focus then rests on the overlay panel, and Tab from there reaches the field first. Do not call .focus() on a field from a picker's mount effect; if content must, check touchOnly() and raisesKeyboard() first.
Smart picker (Combobox)#
<Combobox> is a field whose list opens anchored to it from 640 px up and as a bottom sheet below; <ComboboxPanel> keeps field and list together inside a dialog. Both follow the ARIA combobox pattern: focus stays in the field, ↑/↓ move the active option, Enter picks, Escape closes, and the number of results is announced.
- Ranking: with an empty query,
pinnedkeys come first (for example "Unassigned" and "You"), then the options picked most often and most recently in thatrankContexton this device (each pick halves in weight every 14 days), then the source order. A tree (getPath) keeps its shape and shows recent picks in a "Recent" group on top. Pick history lives in the device-localpickHistorytable: it is never synced or exported and is cleared on sign-out. - Matching: case- and accent-insensitive. An exact label beats every query word being a word prefix (in the label or
getSecondary, such as an email), which beats letters in order (fuzzy, two characters or more). Matches are highlighted; a nested match shows its path. - Sources: an array, or
(query, signal) => Promise<{ items }>for large or remote sources (debounced 120 ms, aborted per keystroke, stale answers ignored, with loading and empty states). Above 200 options the list is windowed; 10,000 options stay under 16 ms per keystroke. - Creating: with
onCreate, a "Create “query”" option comes last when nothing matches exactly.multiplekeeps the picker open and clears the query after each pick.
Surfaces and patterns#
Card, Badge (soft or solid, any palette hue or stored colour; for a category such as a role or a scope), StatusIndicator (a 6 px dot in a tone, ok, warn, danger, busy or off, followed by the word that states it; for state such as On, Working or Failing; busy pulses unless motion is reduced), Avatar (initials on a colour derived from the account id, the same on every device), Tabs (arrow keys, Home/End; a row wider than its space, such as a long translation on a phone, scrolls sideways inside itself as a designated data-scroll-x region and fades out at the edge where tabs are hidden; with fit, as in the task panel, the row never scrolls: when the words do not fit it measures itself and shows each tab's icon with its value or count, the selected tab keeping its word while that fits, and each tab's full name in its accessible name and tooltip), EmptyState and Timeline (events and comment threads). For settings: SettingsSection (a flat titled section whose heading outranks its rows, body size, semibold and the strong colour, with one line that may end with a Learn more link, learnMore, opening the card's guide section; never a header action; inside SettingsPageProvider a page's only section, or one titled like the page, hides its heading and hands its line to the page head), SettingRow (label and state beside the control, stacked on phones except a switch, which stays on the label's line; inline and stack override that; scope="server" adds the "This server" badge) and SaveBar with useDraft (the bar of a form of several fields, shown only while the draft differs; screens use SettingsSaveBar, which adds the leave guard), all fed by the settings copy table (web/src/lib/settingsCopy.ts; limits in the interface guide). ConfirmDialog replaces window.confirm (focus starts on Cancel; a destructive one ignores taps outside); the app never uses the browser's confirm() or prompt(), and code never finds elements by translated text (use a data-* attribute), and ListRow is the focusable row for lists with a trailing menu.
Five surface styles, each a class in @layer components built from tokens (Foundations/Surfaces in the workbench):
| Style | Class | Used for |
|---|---|---|
| Card | surface-card |
statistics tiles |
| Flat section | ui-section-flat, ui-settings-section |
statistics panels; settings sections (rows between hairlines, no card) |
| Column | ui-column, ui-cards--lift, ui-drop-placeholder |
board columns, lifting cards, where a dragged card lands |
| Block | ui-block (--row, --dashed, --past, --late) |
calendar blocks, Month and Plan rows, timeline bars |
| Event | ui-block--event, ui-block-dot |
events from other calendars |
Every drag needs a way without dragging (WCAG 2.2 2.5.7): an element that starts a drag, a resize or a swipe carries data-drag-id, and scripts/ux-audit/drag-alternatives.json names its alternative, a menu item or a control (web/src/lib/a11y/dragAlternatives.test.ts fails otherwise). A short ordered list without a row menu drags by MoveHandle (web/src/ui/MoveHandle.tsx): pressed and moved it drags, clicked it opens Move up and Move down.
Text cut with an ellipsis outside a control uses TruncatedText (web/src/ui/TruncatedText.tsx): while it is cut it takes keyboard focus and shows its whole text in the Tooltip on hover and focus; while it fits it is plain text. A control named by its content (a button, a link) cuts its own text instead.
A block reads data-hue: the soft hue as fill, a 3 px solid edge, text-strong. --past mixes the fill toward the surface and uses text-faint (measured per hue in the contrast pairs); --late takes the danger pair whatever the hue.
Safe areas#
index.html sets viewport-fit=cover, so the app runs under the status bar, the notch or Dynamic Island, the home indicator and, in landscape, the rounded sides of the screen. index.css reads env(safe-area-inset-*) once, into the tokens --safe-top, --safe-right, --safe-bottom and --safe-left, with the utilities pt-safe, pb-safe, pl-safe, pr-safe and px-safe. Every surface that touches an edge of the viewport pads by them where it touches it: the phone bar and full-screen sheets at the top, the tab bar, bottom sheets, sticky footers and toasts at the bottom, the shell, side panels and dialog overlays at the sides. With a minimum, write the token in an arbitrary value (pt-[max(0.5rem,var(--safe-top))]). Code that places a panel itself reads the insets with safeInsets() (web/src/ui/overlay/safeArea.ts); place() keeps anchored popovers clear of them. Nothing else reads env() (the token lint fails on it), and make safe-area-check (scripts/e2e-safe-area.mjs) opens every screen and overlay as the installed app on a phone with a Dynamic Island, in portrait and landscape, and fails when a control sits in an inset.
The status bar's backdrop (GitHub issue 999): on an iPhone, Safari covers the strip under the status bar with a soft blur, taller than the strip and drawn over the page below it, unless an opaque fixed element spans the top edge, whose colour it extends instead. index.html holds that element before the app ([data-status-bar-backdrop], styled in index.css): the canvas, as tall as --safe-top, under the side panels, the drawer and every overlay, which pad their own tops by the inset. Keep it, and keep its colour the canvas the phone bar sits on. The safe-area check also fails when a screen has no such backdrop or draws text under the status bar at rest: as it loads, after each of its overlays closes, and after a cold start with the insets arriving late (topEdge in scripts/ux-audit/measure.mjs).
Touch#
On a touch screen (pointer: coarse) the app behaves like an app, not a page (shell-touch, GitHub issue 1338). The rules are in index.css:
- The browser's tap highlight is off, so a control needs its own pressed state;
hover:does not apply on touch..ui-btnhas one. Any other control names its pressed colour withpress-<colour token>(press-selected,press-danger-soft,press-accent-hover): on touch it takes that background at once while a finger is on it. Addpress-inseton a 44 px target around a small glyph (a row's checkbox): the colour keeps to 28 px. A row's touch targets do not overlap: each control has its own 44 px, and where the glyph is not the target's centre (the fold arrow, whose target reaches back over the indent) the circle is drawn around the glyph (phone-row-controls). A task row takes the selected-row surface while its body is pressed. A control with none of these dims to 60%, the fallback; the two never stack (touch-pressed-states). - Chrome is not text: every button, tab, menu item, option, switch and
summary, everynav, the phone bar, the sidebar andPageHeadercannot be selected or called out by a long press. Everything else is content and stays selectable, as does a field or an editable area inside chrome. A new control is covered by its element or role; text that a person may want to copy must not be put inside a button or anav.select-texton an element overrides the rule. - A sidebar row on touch gives its name the room (touch-sidebar-names): inside the sidebar's scroller a row marked
data-menu-rowkeeps its menu button at the end of the row, unpainted and out of a finger's way until it has keyboard focus, and a hold on the row opens the menu (holdForRowMenu). A new row with a menu takes the marker, nothing else.ui-wholeshows a text whole or not at all on touch (the footer's name, the sync words) and is a plaintruncatewith a mouse. - The page ends the overscroll chain (
overscroll-behavior: noneon the root): no bounce, no pull glow, no reload on a pull. Scrollers keep their own behaviour and still get every touch event. - Zoom stays: no
touch-actionon the page that blocks pinch. - A grid of choices (the icon picker's icons, the palette swatches) is a grid of 44 px targets: each cell takes
touch-targetand its gridTOUCH_GRID(fromweb/src/ui), which on touch lays out as many columns of at least 44 px as the width holds, stretched evenly and 2 px apart, so no two targets overlap; seven columns at 360 and 390 px. Keyboard movement reads the columns as drawn, never a fixed number. In a phone's sheet the picker's field, icons and swatches keep the sheet's inset, in line with its title: content placed bare in a sheet getsin-data-[overlay=sheet]:px-2(phone-icon-picker).
With a mouse nothing changes. The layout check (touchFeel in scripts/ux-audit/measure.mjs) fails on a selectable control, an unselectable field or comment, a page that bounces or a viewport that turns zoom off.
The workbench#
Storybook is a development tool only: it adds nothing to internal/web/dist, the Go binary or the container image, and a unit test fails if the production build contains Storybook code.
make storybook(ornpm run storybookinweb/) opens it on http://localhost:6006. The toolbar switches the theme (light, dark, side by side) and the frame width (375 or 1280 px). A third switch picks the interface language: a story then renders with that language's catalog (loaded the way the app loads it) andlangset on the frame, which shows where a longer German or French label wraps. The accessibility gate and the visual baselines always run in English.npm run build-storybookwrites the static build toweb/storybook-static/(not committed).- Foundations shows the colour tokens with their live contrast ratios, the palette, type, spacing, radius, elevation and the component classes. Foundations → Motion plays each sequence with a Play control over seeded rows: the completion on a row and on a card, the repeating completion, a list reflow, the dialog, the phone sheet, the task panel and the toast (OpenSpec
motion-v2).
Adding a story#
Put a *.stories.tsx file next to the component, in Component Story Format; make check fails when a component in web/src/ui has no stories file importing it. Interaction tests opt into a DOM with // @vitest-environment happy-dom and use the helpers in web/src/ui/test-utils.tsx. Stories render with fixture data only, never Dexie or the network. Cover the states that matter (default, disabled, error, long text) and check them in both themes and at 375 px.
The phone UI (web/src/phone/, OpenSpec phone-ui-trial) is built in the workbench too, and held to the same rule as web/src/ui: a component or a screen there without a stories file beside it fails make check. Its stories draw inside PhoneFrame (web/src/phone/stories/frame.tsx), a phone-sized box at any Width, so the accessibility and visual checks see a phone: Phone → Components for each part, Phone → Design for a screen with fixed data, Phone → Screens for a screen on the seeded account, and Phone → Panes for two screens side by side.
Every entry of the screen inventory, rare ones included, names the story that shows it. Screen stories seed the local database through withSeed in web/src/app/stories/fixtures.tsx. A screen that reads one answer from the server by a token (a reset or invitation preview, a public list) gets it from answerRequests, which answers listed paths with a fixture and every other request with 404, so the whole screen renders as a visitor sees it.
Checks#
| Check | Runs in | Fails on |
|---|---|---|
| Token contrast, token lint, workbench exclusion | npm test, make check |
a pair under its minimum; a raw colour in web/src/ui; a focus ring cancelled by outline-none (Tailwind 4 reads the outline style from it, so focus-visible:outline-2 beside it needs focus-visible:outline-solid); cursor-default or cursor-auto without cursor-lint-allow and a reason on that line or the one above (one base rule in index.css gives every enabled button, menu item, tab, option, summary, label[for], link and task row the pointing hand; a utility such as cursor-grab still wins); Storybook code in the production build |
| Accessibility | make ui-check, CI job "UI check" |
any serious or critical axe-core (WCAG 2.2 AA) violation in a story, light or dark; on a Screens/* story, an element that shows no focus ring when tabbed to (an element is skipped only when scripts/ux-audit/focus-exempt.json lists it with a written reason; the list is empty) |
| Story coverage | make ui-lint (scripts/ux-audit/stories.mjs) |
a core screen of the inventory without its story; rare screens are listed, not failed |
| Visual regression | make ui-check, CI job "UI check" |
a story × theme × width screenshot that differs from its baseline by more than 0.2% |
| Motion | make ui-check (scripts/ui-check/motion.mjs) |
a Foundations → Motion story that, with reduced motion emulated, runs an animation changing transform, translate, scale, height, block-size, width or inline-size, or that runs any animation under data-motion="none"; it names the story and the property |
make ui-check needs Playwright and @playwright/test 1.56.1 installed globally, as CI does (npm i -g [email protected] @playwright/[email protected] && playwright install chromium). Set PLAYWRIGHT_NODE_PATH to use another install. Failures leave actual, expected and diff images in web/test-results/ui-visual, and CI uploads them as the ui-check-report-<shard> artifact of the visual regression shard that failed.
Updating baselines#
Font rendering differs between operating systems, so baselines are only generated inside the pinned Playwright image. They live on the ui-baselines branch, one commit that is replaced on every change, so main's history doesn't grow with each copy of every image. Before comparing, make ui-check and CI run node scripts/ui-check/baselines.mjs fetch, which puts the branch's set in web/.ui-baselines/ (ignored by git) and lays any PNGs in web/src/ui/__screenshots__/ over it. Offline, it keeps the set it fetched last.
A pull request carries only the baselines it adds or changes, in web/src/ui/__screenshots__/:
- With Docker:
make ui-baselinesregenerates inside the image and copies the new or changed baselines there; review and commit them. - Without Docker: run the UI baselines workflow on your branch (Actions → UI baselines → Run workflow) and commit the PNGs of its
ui-baselinesartifact there. Fill in stories with the stories your branch changes, as a regular expression over their ids (for examplescreens-signed-out): every story takes close to the job's time limit. Or take a failing "UI check (visual regression)" job'sui-check-report-<shard>artifact: its*-actual.pngfiles, renamed without-actual, are the new baselines.
After the pull request merges, the UI baselines workflow folds those PNGs into the branch and opens a pull request, "Move UI baselines to the ui-baselines branch", that removes them from main through the merge queue; a later fold updates the same pull request. Running it on main regenerates every baseline and replaces the branch. Update baselines only for intended visual changes, in the same pull request as the change.
The interface audit#
The workbench checks stories; the audit checks the built app. make ux-audit starts a throwaway server, seeds it the way the layout check does, and opens every entry of the screen inventory (scripts/ux-audit/screens.json: every route, settings section, signed-out screen, display route and the main overlays) at 360, 768 (both with touch) and 1280 px, light and dark, in English and German. Each browser it opens is a device that never synced, so it waits for the first sync to end (ot:sync-idle) before the first capture: the screens are measured as they open on a synced device. It writes ux-audit-report/index.html, a contact sheet with a screenshot of each capture and the findings ranked, and report.json. CI runs it nightly on main, and on demand on any branch (Actions → Interface audit → Run workflow), in its own workflow (.github/workflows/ux-audit.yml) and uploads the report; it never blocks a pull request or delays publishing an image.
| Id | Measures | Limit |
|---|---|---|
| M1, M9 | axe-core, WCAG 2.2 AA; contrast reported apart | no serious or critical issue |
| M2 to M5 | the interface budget: chrome rows, a row's metadata, primary destinations, vertical scrollers | web/src/app/budget.json |
| M6 | an element or the page wider than the viewport, outside data-scroll-x |
none |
| M7 | target size | 44 px on touch; 24 px, or 24 px of space around it, with a mouse |
| M8 | focus: Tab through the screen at 1280 px | a ring on every focusable element |
| M10 | text cut with an ellipsis | its full text in the accessible name, the tooltip (data-tip) or an sr-only neighbour |
| M11 | two controls overlapping; fixed chrome (the tab bar, the add button) and a stuck sticky bar (the task page's comment field) over content that scrolls under them are not compared, except the add button on a page's primary action | at most 4 px |
| M12 | layout shift from navigation to idle | 0.1 |
| M13 | the first task row on a second visit with the server stopped | reported |
| M14 | story coverage of the core screens | none missing |
| M15 | movement under reduced motion, watched from before the action until it settles: every overlay as it opens (1280 px with a mouse, 360 px on touch), completing a task in Today, and dragging a board card, a Plan task and a Week block | none |
German captures cover every screen; overlays are opened in English, because their openers find controls by name. A finding seen only in German is marked so (M16). Each finding is scored by severity (4 blocks a task, 3 slows it, 2 breaks a guideline, 1 is cosmetic) times how often the screen is used (3 daily, 2 weekly, 1 rare), and the report lists the highest first.
ONLY (inventory ids), WIDTHS, THEMES, LANGS, CONCURRENCY and OUT_DIR narrow a local run. With UX_AUDIT_STRICT=1 the audit exits non-zero on budget, overflow, story-coverage and reduced-motion findings; in CI the repository variable UX_AUDIT_STRICT turns that on. The measurements have fixture tests in scripts/ux-audit/measure.test.mjs (one passing and one failing case each), and scripts/ux-audit/ux-audit.test.mjs keeps the inventory in step with the router and the layout check.
The accessibility gate on real screens#
The same tour is the accessibility gate (OpenSpec accessibility, change accessibility-aa). A11Y_ONLY=1 takes no screenshots, skips the budget, motion and offline measures and fails on the accessibility rules only; A11Y_STRICT=1 adds them to a full tour. Serious and critical axe findings cannot be exempted.
| Id | WCAG 2.2 | Measures | Fails on |
|---|---|---|---|
| M1, M9 | A and AA rules | axe-core on the screen or the open overlay | any serious or critical issue |
| M8 | 2.4.7 Focus visible | Tab through every entry at every width (an open overlay keeps its focus and is walked from there) | a stop without a ring (an outline or a shadow, on the element, its ::before/::after, or the two nearest ancestors) |
| M17 | 2.4.11 Focus not obscured | during the walk, the corners and centre of the focused element, two frames after the move | none of them hits the element (a sticky header, the tab bar, a toast or a sheet covers it) |
| M18 | 1.4.10 Reflow | the screen at 320 × 256 CSS px (1280 × 1024 at 400%) | the page or any element scrolls sideways, outside a tab row and the two-dimensional regions in scripts/ux-audit/reflow-exempt.json (each with its reason) |
| M19 | 1.4.12 Text spacing | the W3C text-spacing styles applied | text cut vertically by an element with hidden overflow |
| M20 | 3.3.8 Accessible authentication | password, one-time code and recovery fields | no autocomplete, or a synthetic paste that the page cancels |
| M21 | 2.5.8 Target size (minimum) | WCAG's own rule: 24 × 24 px, or a 24 px circle that meets no other target of the same layer | an undersized target too close to another |
| NAV | the entry opens | a screen or overlay that does not open |
Every pull request that changes web/ or scripts/ux-audit/ runs it at 360 and 1280 px, light and dark, in English, in two shards (CI job "Accessibility (screens)"). The nightly workflow runs the full matrix (360, 768 and 1280 px, English and German, browser text size 20 px) in four shards, and a failure there opens the ci-nightly issue. Locally: make build && A11Y_ONLY=1 WIDTHS=360,1280 LANGS=en node scripts/ux-audit/tour.mjs (add REFLOW_SHOTS=1 for a screenshot of each entry at 320 px). The failure lines name the screen, width, theme, language, rule and element.
What the app does to pass, so new screens follow it: a modal dialog or bottom sheet makes the app behind it inert (useOverlay({ blocking })), and the phone drawer is an overlay that keeps Tab inside while open and is inert while closed; a toast moves out of the way of the focused element (useToastClearance, built into ToastRegion); a focused element under a sticky or fixed bar is scrolled clear of it (lib/focusClearance.ts); menu items draw the focus ring as well as the selected background.