Download docs/DESIGN_SYSTEM.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 15.8 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/DESIGN_SYSTEM.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/docs/DESIGN_SYSTEM.md
-
curl -L -o DESIGN_SYSTEM.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/docs/DESIGN_SYSTEM.md
Patchwise design system
Audience: anyone changing the web app's UI.
Source of truth: web/src/styles/00-tokens.css. All three styling layers read from it:
| Layer | How it uses the tokens |
|---|---|
App CSS (styles.css, apple*.css) |
var(--token) |
Mantine (theme.ts) |
Theme sizes are var(--token) strings |
Tailwind / beUI (beui.css) |
@theme maps text-*, rounded-*, font-* and shadow-* to the tokens |
Rule: no raw px, hex or rgba values outside tokens.css. There are four exceptions:
- Hairlines (1 px borders, 1 to 4 px decorative bars).
50%for circles.- Mantine's colour ramps in
theme.ts(Mantine needs real colours). - The
.trio-force-darkblock inbeui.css, which copies the dark values for the always-dark sign-in frame.
If a value you need is missing, add a token here first.
Colour
Colours are semantic and switch with the scheme (data-mantine-color-scheme on <html>, set by Mantine from the OS setting or the user's choice). Never pick a colour by its appearance; pick it by its role.
Surfaces
| Token | Use | Light | Dark |
|---|---|---|---|
--bg |
Main canvas | #ffffff |
#111113 |
--bg-base |
Sidebar, recessed areas | #fafafa |
#0c0c0e |
--bg-elev |
Cards, panels, dialogs | #ffffff |
#18181b |
--bg-elev-2 |
Frames, table headers, stat-card footers | #f7f7f8 |
#1f1f23 |
--fill, --fill-2, --fill-3 |
Quiet fills: chips, hover, pressed | 4 / 7 / 11 % black | 10 / 16 / 24 % white |
--sep, --sep-strong |
Hairline borders of cards and dividers; control outlines | #ececee, #dedee2 |
8 %, 14 % white |
--mat-sidebar, --mat-bar, --mat-pop |
Translucent materials. They become solid with reduced transparency or without backdrop-filter |
||
--scrim |
Behind dialogs and drawers |
Text
All text colours meet WCAG AA (4.5:1) on --bg, --bg-elev and --fill.
| Token | Use | Light | Dark |
|---|---|---|---|
--label |
Primary text, titles | #1d1d1f |
#f5f5f7 |
--label-2 |
Secondary text, descriptions; Mantine dimmed |
#636366 |
#b4b4b9 |
--label-3 |
Tertiary text: meta, timestamps | #6e6e73 |
#98989d |
--ph |
Input placeholders | #70707a |
#98989f |
With prefers-contrast: more, --label-2 and --label-3 get darker (light) or lighter (dark), and separators get stronger.
Accent
Ember (after Sheryians Coding School). The app is always dark: a black canvas (#050505) with a warm orange glow behind the top of each page, cards one step up (#0e0e0e) with hairline borders that glow orange on hover. The ember orange (#e8602e) marks highlights, rings, bars, the selected page and caps labels; primary buttons use the deeper #c4471a so white text passes AA. Green, red and amber are reserved for passed, failed and waiting; running is a cool blue. Navigation is a top bar with the pages in a bordered capsule (setup and admin under More) and the environment as an ember pill. One primary action per screen.
| Token | Use |
|---|---|
--accent / --on-accent |
Primary button background and its text |
--accent-hover |
Hover state of the primary button |
--accent-press |
Pressed state of the primary button |
--accent-text |
Links and selected text |
--accent-soft, --accent-soft-2 |
Selected rows, the text selection |
--focus, --focus-gap |
The focus ring: a 2 px outline with a gap in the surface colour |
Status
Each status comes in three forms:
| Form | Use |
|---|---|
Text colour (--green, --orange, --red) |
AA on its soft background and on cards |
Soft background (--*-soft) |
Badges and banners |
Dot (--*-dot) |
Graphics only (dots, bars, the 3D globe), never text |
| Meaning | Text | Soft | Dot |
|---|---|---|---|
| Passed, ready, done | --green |
--green-soft |
--green-dot |
| Waiting for a person, practice environment | --orange |
--orange-soft |
--orange-dot |
| Failed, defect, destructive | --red |
--red-soft |
--red-dot |
Aliases for charts and 3D: --status-pass, --status-fail, --status-wait and --status-idle.
Typography
Family
--font-display: Space Grotesk (titles, big numbers, caps labels, table headers).--font: Manrope, everywhere else: navigation, buttons, tabs, table headers, titles and reading text, always in sentence case. Hierarchy comes from size, weight and colour, never from capitals (type.css).--mono: Geist Mono, for IDs, code and keyboard keys only.- Icons: Lucide (outline, 1.75 px stroke) through
web/src/components/icons.tsx; brand logos stay Tabler's. - Wensity UI components (MIT, free tier) in
components/wensity/: title blur reveal, count-up numbers, marker highlight, shimmer for live states, the activity grid; they read the app's tokens throughwensity.css. - Mouse effects (
components/shell/CursorFx.tsx): a follower ring, magnetic primary buttons and a soft title rise; mouse only, off with reduced motion, switchable in the account menu. The system cursor always stays. --font-display-monois an alias of--font, kept so older rules follow the one family.
Sizes. Each size has a paired line height. Use them together.
| Token | Size / line | Use |
|---|---|---|
--fs-2xs / --lh-2xs |
11 / 14 | Badges and counters |
--fs-xs / --lh-xs |
12 / 16 | Captions, meta, footnotes |
--fs-sm / --lh-sm |
13 / 18 | Secondary text, dense tables, small controls |
--fs-base / --lh-base |
14 / 20 | Body text and form fields (default) |
--fs-md / --lh-md |
15 / 22 | Reading text: explanations, chat messages |
--fs-lg / --lh-lg |
17 / 24 | Card and section titles (h3) |
--fs-xl / --lh-xl |
20 / 26 | Dialog titles, sub-page titles |
--fs-2xl / --lh-2xl |
24 / 30 | Section headings on long pages (h2) |
--fs-3xl / --lh-3xl |
28 / 34 | Page titles (h1) |
--fs-4xl / --lh-4xl |
34 / 40 | Hero numbers and hero headings |
--fs-display / --lh-display |
52 / 54 | Sign-in headline only |
Weights
| Token | Value | Use |
|---|---|---|
--fw-regular |
400 | Body text |
--fw-medium |
500 | Labels, navigation, chips |
--fw-semibold |
600 | Emphasis, buttons, card titles |
--fw-bold |
650 | Page titles, hero and headings only |
Tracking
| Token | Value | Use |
|---|---|---|
--ls-body |
−0.006em | Body text |
--ls-title |
−0.016em | 17 px and up |
--ls-display |
−0.03em | 28 px and up |
--ls-caps |
+0.04em | All-caps labels |
The same names in each layer
| Token | Mantine | Tailwind |
|---|---|---|
--fs-xs |
fz="xs" |
text-xs |
--fs-sm |
fz="sm" |
text-sm |
--fs-base |
fz="md" |
text-base |
--fs-md |
fz="lg" |
text-md |
--fs-lg |
fz="xl" |
text-lg |
Mantine Title h1 to h6 maps to 3xl, 2xl, lg, md, base and sm.
Headings. One h1 per page (the page title). Levels go down one at a time (h1, then h2, then h3).
Space, shape, size
Space
A 4 px grid:
--sp-14 ·--sp-28 ·--sp-312 ·--sp-416 ·--sp-520 ·--sp-624--sp-832 ·--sp-1040 ·--sp-1248 ·--sp-1664
Mantine xs, sm, md, lg and xl are 8, 12, 16, 24 and 32. Tailwind's spacing unit is the same 4 px (p-4 = 16 px).
Spacing rhythm
| Gap | Where |
|---|---|
| 4–8 | Inside a control |
| 12–16 | Inside a card |
| 16–24 | Between cards |
| 32–48 | Between page sections |
Radius
| Token | Value | Use |
|---|---|---|
--r-sm |
6 | Small parts: tags, icon squares, tooltips, segment thumbs |
--r-md |
8 | Controls: buttons, inputs, selects, menu items |
--r-lg |
12 | Cards, stat cards, tables, popovers |
--r-xl |
16 | Dialogs, sheets, the Ask question field |
--r-pill |
999 | Status pills only |
Elevation
| Token | Use |
|---|---|
--sh-card |
A 1 px hairline (--sep): surfaces are separated by borders, not shadows |
--sh-pop |
Menus, popovers, dialogs, drawers |
--sh-seg |
The thumb of a segmented control or filter chip |
There are no other shadows.
Surface utilities (web/src/styles/20-surfaces.css)
| Class | Use |
|---|---|
.pw-card |
White panel, 1 px border, 12 px radius |
.pw-frame |
Light grey 4 px frame around a .pw-card |
.pw-hatch, .pw-hatch-diag |
12 px strip of fine lines that frames a panel (decorative, aria-hidden) |
.pw-status |
Status word with a dot; data-tone green, orange, red, blue, neutral; data-variant="outline" for tags |
.pw-icon-sq |
20 px coloured square marking a row (initials or icon); also violet, teal |
.pw-stat |
Stat card: .pw-stat-body (.pw-stat-k label, .pw-stat-v number) and .pw-stat-foot (.pw-delta[data-dir]) |
.pw-table |
Dense table: grey header band, hairline rows, hover fill |
.pw-crumb |
Breadcrumb in the top bar |
Buttons are 8 px-radius rectangles: filled is black (near-white in dark), default is white with a 1 px border.
Control heights
| Token | Height | Use |
|---|---|---|
--h-2xs |
24 | Compact controls inside tables and chips |
--h-xs |
28 | Compact controls inside tables and chips |
--h-sm |
32 | Default button; small input |
--h-md |
40 | Default input; large button |
--h-lg |
48 | Sign-in fields and buttons, hero actions |
Mantine size="xs" and "sm" buttons are 32. Inputs: xs 32, sm (default) 40, md 48.
Layering
| Token | Value |
|---|---|
--z-sticky |
10 |
--z-sidebar |
100 |
--z-drawer |
200 |
--z-popover |
300 |
--z-modal |
400 |
--z-toast |
500 |
Layout
Breakpoints: 640 / 768 / 1024 / 1280 / 1536.
| Layer | How it expresses them |
|---|---|
| CSS media queries | max-width: 767px, 1023px, 1279px and min-width: 768px, 1024px, 1280px |
| Mantine | xs … xl = 40, 48, 64, 80, 96 em |
| Tailwind | sm … 2xl |
The shell (components/shell/prefs.tsx) |
Phone < 768, tablet < 1024, laptop < 1280 |
CSS variables can't be used inside media queries, so these numbers are repeated in each place. Don't add others.
Widths
| Token | Value | Use |
|---|---|---|
--gutter |
16 / 24 / 32 px | Page side padding from phone up to 1280+ |
--w-form |
480 px | Forms |
--w-reading |
720 px | Long text |
--w-content |
1200 px | The main column |
--w-wide |
1440 px | Data-heavy pages |
--sidebar-w |
264 px | Sidebar |
--panel-w |
440 px | Side panel |
--topbar-h |
56 px | Top bar |
Layout rules (Step 4 acceptance)
- Page headers wrap; actions move under the title on phones and never overlap it.
- Cards are as tall as their content, not as tall as the tallest card in the row.
- A page uses its width with a grid (main column plus side column where useful), not a narrow column in an empty page.
- Nothing scrolls sideways at 375 px, and nothing is clipped.
Motion
| Token | Value |
|---|---|
--ease |
Standard curve |
--ease-sheet |
Drawers and sheets |
--ease-spring |
Small confirmations only |
--d1 |
120 ms |
--d2 |
200 ms |
--d3 |
320 ms |
Motion is functional: it shows where something came from or that an action worked. With prefers-reduced-motion, every duration is 1 ms, and the 3D scenes render one still frame.
Accessibility baseline
- Text contrast is AA in both schemes. At 375 px across 16 pages × 2 schemes, the axe colour-contrast check went from 111 failing elements to 12. One of the 12 has since been fixed (the count in an active filter chip). The other 11 are agent cards dimmed with
opacity, to be fixed in Step 3. - Status is never shown by colour alone: there is always a word or an icon too.
- Focus is always visible:
:focus-visibledraws a 2 px--focusoutline. - Touch targets are at least 32 px; 40 px for primary actions on phones.
Where things live
| File | What |
|---|---|
web/src/styles/00-tokens.css |
Tokens (section 1 colour, 2 scales, 3 legacy aliases) |
web/src/theme.ts |
The Mantine theme from the tokens, and component defaults |
web/src/styles/30-tailwind.css |
The Tailwind theme from the tokens; shadcn names for beUI parts |
web/src/styles/10-apple.css |
Base element styles and Mantine control styling |
web/src/styles/01-base.css, apple-*.css |
Screen styles (rebuilt page by page in Step 4) |
Legacy names. --fpt-*, --pill-*, --r-xs and --r-2xl still work as aliases (tokens.css section 3). Don't use them in new code. Step 4 removes each one when the last page using it is rebuilt.
Components
Use these before writing new markup. Mantine components are themed from the tokens. Only reach for a beUI (Tailwind) component on the account pages, or when it adds behaviour Mantine lacks.
Layout and navigation
| Need | Use | Notes |
|---|---|---|
| Page title, description, actions | PageHeader (components/common.tsx) |
One h1. Actions sit right while they fit, then wrap under the title; full width on phones. Never set fixed widths on header inputs |
| Views of one object with their own URL | NavTabs (components/NavTabs.tsx) |
Links with aria-current="page" in a named nav. Use Mantine Tabs only for panels on the same page |
| Paging | Pager |
Inside a nav named "Pagination"; every button is named ("Page 2 of 3", "Next page") |
Data and states
| Need | Use | Notes |
|---|---|---|
| A table | DataTable (components/states.tsx) |
Named scroll region reachable by keyboard, skeleton rows while loading, error with "Try again", one explanatory empty row. Hidden column headers: { label: 'Actions', hidden: true } |
| Any block that loads data | QueryState |
Loading, then error, then empty, then content, from a TanStack query |
| Loading | LoadingState |
Skeleton lines, announced once (role="status") |
| Nothing here yet | EmptyState |
Icon, one title, one sentence, at most one action |
| Something failed | ErrorAlert |
Plain words, field errors, a "Copy details for support" link and an optional onRetry |
Actions and inputs
| Need | Use |
|---|---|
| Primary action (one per screen) | <Button variant="filled"> |
| Other actions | <Button> (default = quiet fill) |
| Low-emphasis actions | <Button variant="subtle"> |
| Inside tables | Compact sizes (size="compact-sm") |
| Icon-only buttons | ActionIcon with an aria-label. Never a bare <button> with its own CSS |
| Forms | Mantine TextInput, Select and the rest at the default size (40 px). On account pages: beUI Input with classNames={FIELD} and StatefulButton |
| Status | Pill / StatusBadge (word plus colour), or a dot plus word. Never colour alone |
Icons
Only @tabler/icons-react.
| Context | Size |
|---|---|
| Inline in text | 14 |
| Buttons | 16 |
| Empty states | 20 |
Decorative icons get aria-hidden. An icon that is the only content of a control needs the control to have an aria-label.
Overlays
Modal and Drawer always have a title. Hide it visually with classNames={{ header: 'fpt-sr-only' }} if the design has no visible title. Never put aria-label on their root.
Known issues (Step 4)
- Heading order on the run guide, Scripts, Learner and Users.
- Run sub-tabs have no
h1. - Team view: some leftover axe findings, mostly decorative
aria-hiddenavatar initials under a scroll fade at 375 px.