Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Visual foundations — color, surfaces, type, spacing, radius, icons
Read this when you set any class that affects color, size, spacing, radius, border, shadow, font or icon. Values here were read from source on 2026-09-28; if a primitive changed since, the primitive wins — re-read it.
Contents
- Color tokens and what each is for
- Semantic color usage (the rules)
- Surfaces and elevation
- Typography
- Spacing and density
- Radius, borders, shadows
- Icons
- Dark mode and themes
1. Color tokens
Tokens are CSS variables injected on <html> per user theme (8 themes in
packages/utils/src/themes.ts, default zinc/"Modern"), mapped to Tailwind in
packages/config/tailwind/theme.css. Never assume the primary is blue — themes change it.
| Token (Tailwind) | Light (zinc) | Role |
|---|---|---|
bg-background |
gray 95% | app chrome: nav rail, page canvas, secondary-button fill, Properties panel (bg-background/30) |
bg-card |
white | the content you work in: content panel, CardContent, Modal, table, drawer body |
bg-popover |
white | dropdowns, popovers, tooltips (primitives set it) |
bg-muted / /50 /40 /30 |
gray 93% | trays (Tabs list), row hover/selected, subtle fills, Modal footer bar (bg-muted/40) |
bg-accent / /60 /30 |
gray 96% | Card shell tray, dropdown focus, hover fill, selected explorer row (bg-accent/60) |
bg-active + text-active-foreground |
gray 85% | Button active variant, selected nav item |
text-foreground |
near-black | primary text |
text-muted-foreground |
gray 46% | secondary text, labels, metadata, decorative icons |
bg-primary / text-primary |
ink (theme-dependent) | primary button, count bubbles, links in places, selection tint bg-primary/10 |
destructive |
red | destructive button, form errors, invalid border (border-destructive) |
border / input |
gray 90% | all borders (global * { border-border } — plain border is enough) |
ring |
ink | input focus ring (focus-visible:ring-ring/50) |
success |
green | defined but ~unused — don't build on it; use Status color="green" or text-emerald-500 icons |
There is no warning or info token. Warnings use Status/Badge yellow/orange,
Alert variant="warning"|"info", or an amber icon.
secondary (bg-secondary) is effectively unused. Don't introduce it.
2. Semantic color — the rules
- Neutral text:
text-foregroundortext-muted-foreground. Nevertext-gray-*,text-zinc-*,text-slate-*. For slightly-muted in-between,text-foreground/70-80. - Status: only through
<Status color>or Badge color variants (seestatus-and-feedback.md). Seven names:gray yellow blue orange green red purple. - Categorical kind (type/entity): hue identifies kind — domain icon maps in
apps/erp/app/components/Icons.tsx, search entity chips; user-defined values viaEnumerable(hash-colored, meaningless by design). - Signed / threshold data:
text-red-500for negative, overdue, failed values in cells (e.g. overdue due date). Positive is usually just neutral;text-emerald-500only when "on time/good" genuinely needs affirming next to a red counterpart. - Prose is never colored for status. No
text-green-*,text-emerald-*,text-amber-*,text-yellow-*sentences ("Planned automatically", "Low confidence"). Usetext-muted-foreground+ aLu*icon (LuCircleCheck,LuTriangleAlert) and let the words carry the meaning (.ai/ds-rules.md). Chips, dots, and severity icons may carry hue. - Charts:
hsl(var(--chart-1..6))and theme vars, never hex. - Hue recipe when you truly need a tinted chip or cell (match
Badge): lightbg-{hue}-100 text-{hue}-800 border-{hue}-500/20, darkdark:bg-{hue}-500/15 dark:text-{hue}-400. Green is emerald, purple is violet. A bare 500-level hue (text-red-500,bg-emerald-500dot) reads in both modes without adark:pair. - Trends and deltas ("+12% vs last month", "3 fewer late receipts"): a
Badge variant="green"|"red"next to the value, as the purchasing dashboard does (apps/erp/app/routes/x+/purchasing+/_index.tsx) — not colored text, not colored arrows. - Numbers inside sentences are never colored ("82% loaded · 40h of 48h"): keep the
sentence muted; if the value is a problem, put a red
Badgeor aLuTriangleAlerticon beside it. - Magnitude encodings (heatmaps, load grids, density): use a few discrete bands, never
a continuous multi-hue ramp or graded opacity steps, and show the number in every cell
(
tabular-nums) so color is never the only signal.- If a sibling view already encodes the same measure, reuse its exact bands — same
thresholds, same classes, ideally the same exported function/constants — so two views
never disagree. Work-center load today:
loadCellClassinapps/erp/app/modules/production/ui/Schedule/People/PeopleCapacity.tsx(> 120% red,100% amber, else emerald, all as
bg-{hue}-500/15 text-{hue}-700 dark:text-{hue}-400). If it isn't exported, propose exporting it rather than copying the numbers. - With no sibling, healthy values stay neutral and hue appears only at problem thresholds (near → yellow/amber tint, over → red tint).
- If a sibling view already encodes the same measure, reuse its exact bands — same
thresholds, same classes, ideally the same exported function/constants — so two views
never disagree. Work-center load today:
- Accent for "the thing that is selected/focused":
bg-accent/60,bg-muted,bg-primary/10,border-primary ring-2 ring-primary/20for selected cards/choices — never a saturated fill.
3. Surfaces and elevation
body / nav rail .......................... bg-background (gray)
└ content panel (md+: inset, rounded-2xl) bg-card (white)
├ Card shell ......................... bg-accent + shadow-button-base + rounded-xl (the tray)
│ ├ CardHeader ...................... transparent, px-6 py-4, text-muted-foreground
│ └ CardContent ..................... bg-card + border + rounded-xl + p-6 (the paper)
├ Tabs list .......................... bg-muted tray; active tab bg-background + shadow
├ Table .............................. bg-card; row hover bg-muted
└ inner boxes ........................ rounded-lg border p-3|p-4 (bg-card or bg-muted/40)
overlays: Modal bg-card rounded-2xl, footer bar border-t bg-muted/40
Drawer floats inset p-3, shell bg-accent > DrawerBody bg-card rounded-xl
Popover / Dropdown / Tooltip bg-popover rounded-md border shadow-md
Properties panel ......................... bg-background/30 border-l, w-96
Rules:
- Compose
Card > CardHeader + CardContent. Content placed directly in<Card>reads gray. Never hand-roll a top-level card fromrounded-lg border bg-card. - One edge per surface. Don't put a border on something whose primitive already draws a
shadow edge (a bordered
CardContentunder aCardHeader→CardContent className="border-0"withCardHeader className="border-b border-border", per.ai/lessons.md"The design-systemCardis a gray tray"). - Tinting a Card shell requires the
dark:twin (bg-emerald-500/5 dark:bg-emerald-500/5) or the basedark:bg-cardsilently wins in dark mode. - Detail content area: copy the background class of the sibling 3-pane route verbatim
(currently
bg-muted dark:bg-cardon all 23 of them — seeanti-patterns.md§Carbon's own drift). Don't invent a third option. - Scroll: the page (or the content pane) is the only scroll surface. No
max-h+overflow-y-autoregions inside cards (.ai/lessons.md"Card lists never get their own scroll region"). - Full-height calcs inside the content panel subtract
var(--topbar-height),var(--header-height)andvar(--content-inset); preferh-fullinheritance for new pages.
4. Typography
Fonts: Geist (sans, everything), Geist Mono (font-mono, ids/codes/system text), Hedvig
Letters Serif (font-headline, page titles only via Heading display/h1/h2/h3).
| Role | Use | Resulting style |
|---|---|---|
| Public / onboarding / greeting title | Heading size="display" or "h1" |
serif |
| List page title | Table title=… (renders Heading h2) |
serif md:text-2xl |
| Settings page / section title | Heading size="h3" |
serif md:text-xl |
Posting document ID (DocumentPageHeader) |
Heading size="h2" |
serif md:text-2xl |
| Record header ID (SO-000123) | Heading size="h4" |
sans md:text-base text-sm font-medium |
| Card / Modal / Drawer title | CardTitle / ModalTitle / DrawerTitle |
sans text-base font-medium tracking-tight |
| Card / Modal description | CardDescription / ModalDescription |
text-xs / text-sm muted |
| Eyebrow / group label | Subheading variant="heavy" (reports) or "light" (Properties, sidebars); as="h3" when it's a real heading |
uppercase, tracked, small |
| Settings group label | SettingsSectionHeader |
wraps Subheading light |
| Body / cells / inputs / menu items | — | text-sm |
| Labels, metadata, helper, errors | — | text-xs (labels font-medium text-muted-foreground) |
| Micro meta | text-xxs (10.8px token) |
only when text-xs truly won't fit |
| IDs, codes, JSON, serials | font-mono text-xs (often text-muted-foreground) |
|
| Any number that changes or aligns | tabular-nums |
|
| KPI value | MetricCard (text-4xl tabular-nums) |
Rules:
- Weight:
font-mediumis the emphasis weight (71%).font-semiboldfor totals rows and KPI numbers.font-boldonly inside Badge and document-summary line totals. Neverfont-extrabold/font-black. - No arbitrary sizes (
text-[11px],text-[13px]) in new code even though ~170 exist. - Uppercase is component-owned (Badge/Status,
Subheading, the mono empty-state label). Don't hand-writeuppercase tracking-widelabels — useSubheading. - Never a raw
<h1 className="text-xl font-semibold">page title — useHeading. - Wrapping:
text-balanceon titles,text-prettyon body (Tailwind v4 names),truncate/line-clamp-1in dense rows;min-w-0on flex children that must truncate.truncateis inert onHeading(it setstext-balance) — wrap it or usenoOfLines. - Page-level serif is a brand moment; never use
font-headlineon card, drawer, modal or record-header titles. A component rendered inside a page (a view, a panel, a section) never rendersHeadingh1–h3 — it titles itself withCardTitle,Subheading, or the host page's existing title (e.g. theTabletitle). - Hover detail uses
Tooltip, never the nativetitle=attribute.
5. Spacing and density
Scale is 4px-based and dominated by 4 / 8 / 16, with 6px for icon-text pairs.
| Use | Value |
|---|---|
| Icon + text in a chip/meta row | gap-1 / gap-1.5 |
| Default gap between siblings | gap-2 (most used utility) |
| Between blocks / cards on a page | gap-4, VStack spacing={4} |
| Form grid | grid grid-cols-1 lg:grid-cols-3 gap-x-8 gap-y-4 (edit), md:grid-cols-2 (create) |
| Drawer form fields | VStack spacing={4} single column |
| Detail content pane | VStack spacing={4} className="p-4" |
| Card internals | CardHeader px-6 py-4, CardContent p-6 (from the primitive — don't override) |
| Inner bordered box | p-3 or p-4 |
| Page-level / empty-state breathing | py-8–py-16, settings page py-12 px-4 |
Controls (heights): Button sm h-6 · md h-8 (default) · lg h-11; IconButton 24/32/44;
Input/Select sm h-8 · md h-10 (default) · lg h-12; table rows 44px. Same-row buttons share a
size. ERP uses md/sm; MES uses lg (see shop-floor-mes.md).
VStack/HStack take spacing (VStack 0,1,2,3,4,8; HStack 0,1,2,3,4,6,8), are
space-y/x-* based and VStack is w-full. Prefer gap-* when a child may inject siblings at
runtime (e.g. Hyperlink prefetch links) — space-* then adds a phantom margin
(.ai/lessons.md "space-x-* gives a phantom margin"). A flex child that fills the rest of a
row is flex-1 min-w-0, never w-full; fixed siblings get shrink-0.
Content widths are capped: full-page create max-w-4xl, posting documents max-w-5xl,
settings max-w-[60rem], party records max-w-[80rem]. 2xl: is never used; xl: rarely.
6. Radius, borders, shadows
--radius = 7px. rounded-sm 3 · rounded-md 5 · rounded-lg 7 · rounded-xl 11 ·
rounded-2xl 15 · rounded-full pills/avatars/dots.
| Element | Radius |
|---|---|
| App content panel, Modal | rounded-2xl (primitive) |
| Card shell, CardContent, Drawer body | rounded-xl (primitive) |
| Buttons, inputs, badges, popovers, dropdowns, tooltips | rounded-md (primitive) |
| App-built inner boxes, list items, tiles | rounded-lg |
| Dropdown items, small buttons | rounded-sm |
App code uses rounded-lg/rounded-md; xl/2xl belong to primitive shells. No rounded-3xl.
Borders: 1px border (color is global). Dividers border-b / divide-y, faded
border-border/60. Drop zones and "add" placeholders border-dashed. Inputs are flat
bordered fields with no shadow (fb5a23f67c).
Shadows: recipe shadows (shadow-button-base, dark inset stacks) live in primitives. App code
uses at most shadow-sm for small floating chips/drag previews; overlays get theirs from the
primitive. No shadow-2xl. Don't use the defined-but-dead tokens shadow-popover,
shadow-dropdown-item, shadow-select-item, shadow-button-danger.
7. Icons
- Library: Lucide via
react-icons/luonly (Lu*, ~96% of icons). No other react-icons sets, nolucide-react, no inline<svg>for new work. A missing glyph is added the wayapps/erp/app/assets/icons/BanknoteArrows.tsxdoes it (GenIcon with Lucide path data, stroke 2). - Sizing: bare
<LuX />renders at 1em and inherits size from text;Button leftIcon/rightIconandIconButtonsize icons themselves (don't add classes). Explicit sizes:size-4(16px) standard,size-3.5/size-3in dense meta rows and chips,size-6/size-8only for empty-state or hero icons. Prefersize-*overh-4 w-4in new code. - Color: inherit, or
text-muted-foreground. Hue only when the icon is the status or type signal (LuTriangleAlert text-red-500for overdue, domain type icons). - Icon + text vs icon-only: actions with a visible label use
leftIcon. Icon-only is for universally understood, repeated, space-constrained actions (⋮, copy, link, close, panel toggles, drag handle, chevrons) and must be anIconButtonwith a translatedaria-label, usually wrapped in aTooltip. If the action needs a word to be understood, it gets a word. - Shared icon vocabulary — reuse, don't re-pick:
| Meaning | Icon |
|---|---|
| Record ID column | LuBookMarked |
| Status column | LuStar |
| Dates (created, due, order) | LuCalendar |
| Person (created by, assignee) | LuUser; customer LuSquareUser; supplier LuContainer |
| Quantity / number | LuHash |
| Location | LuMapPin; tags LuTag; item group LuGroup; email LuMail |
| Edit / Delete | LuPencil / LuTrash |
| Add | LuCirclePlus (buttons), LuPlus (compact) |
| More options | LuEllipsisVertical (never horizontal) |
| Explorer / Properties toggles | LuPanelLeft / LuPanelRight |
| Warning / error inline | LuTriangleAlert; confirmed LuCircleCheck; copy LuCopy; link LuLink |
| Domain types | MethodIcon, MethodItemTypeIcon, TrackingTypeIcon, TimeTypeIcon, OperationStatusIcon from apps/erp/app/components/Icons.tsx |
| Module icons | apps/erp/app/hooks/useModules.tsx |
8. Dark mode and themes
.dark class on <html> swaps every variable, so token-only UI needs no dark: classes.
You need dark: only when you use a raw palette hue (then use the Badge recipe in §2) or tint
a primitive shell. In dark mode card is darker than background — never assume "card is
lighter". Test both modes and at least one non-zinc theme (e.g. blue) when you introduce any
color.