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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Design System Rules
Rules for UI code in Carbon. These are laws, not suggestions. Follow them when writing or reviewing any UI component.
Components — Use What Exists
Decision Tree
| Need | Use | Import From |
|---|---|---|
| Button | Button (with variant) |
@carbon/react |
| Icon-only button | IconButton (with aria-label) |
@carbon/react |
| Form submit | Submit |
@carbon/form |
| Text input | Input |
@carbon/form |
| Number input | Number |
@carbon/form |
| Select/dropdown | Select |
@carbon/form |
| Boolean/checkbox | Boolean |
@carbon/form |
| Date picker | DatePicker |
@carbon/form |
| Domain selector (Customer, Item, etc.) | Named selector | @carbon/form |
| Vertical stack | VStack (spacing prop) |
@carbon/react |
| Horizontal stack | HStack (spacing prop) |
@carbon/react |
| Card/container | Card / CardContent / CardHeader |
@carbon/react |
| Modal/dialog | Dialog / DialogContent |
@carbon/react |
| Data table | Table (from Tanstack) |
~/components |
| Tabs | Tabs / TabsList / TabsTrigger |
@carbon/react |
| Toast/notification | flash() from session |
@carbon/auth/session.server |
| Class merging | cn() |
@carbon/react |
| Icons | Lucide React (Lu*) |
react-icons/lu |
Button Rules
- ALWAYS use a built-in
variant— never style a bare<button>or<div>as a button - Variants:
primary·secondary·solid·active·destructive·ghost·outline·link - Sizes:
sm·md(default) ·lg - NEVER use raw
onClickhandlers for form submissions — useSubmitcomponent - Same-row buttons MUST share the same
size - Use
IconButton(witharia-label) for icon-only buttons, notButtonwithisIcon
Layout Rules
- ALWAYS use
VStack/HStackfor vertical/horizontal layouts — not rawflexdivs VStackspacing:0, 1, 2, 3, 4, 8(maps to Tailwindspace-y-*)HStackspacing:0, 1, 2, 3, 4, 6, 8(maps to Tailwindspace-x-*)- NEVER use arbitrary spacing values — use the scale
Color Rules
- NEVER hardcode Tailwind colors for status indicators (
text-red-500,bg-green-100) - ALWAYS use semantic status classes or component variants
- Prefer component props (
variant="destructive") over color classes - Background colors: use card/surface components, not raw
bg-*classes - NEVER use green/emerald text (
text-emerald-*,text-green-*) OR yellow/amber text (text-yellow-*,text-amber-*) as an inline status indicator (e.g. a "Planned automatically" success note or a "low confidence" caution note). Keep inline status understated (Vercel aesthetic): neutraltext-muted-foreground, with aLu*icon (e.g.LuCircleCheck,LuTriangleAlert) if affirmation/emphasis is needed, and let the wording carry the meaning. This is about colored prose, not chips or icon glyphs —Status/Badgestatus components (includingcolor="green"/"yellow"), status dots (bg-green-500), and severity icon colors are fine and encouraged for status affordances.
Typography Rules
- NEVER use arbitrary text sizes (
text-[13px]) - Use the Tailwind scale:
text-xs·text-sm·text-base·text-lg·text-xl·text-2xl - Muted text:
text-muted-foreground(nottext-gray-500)
Form Rules
- ALWAYS use
ValidatedFormfrom@carbon/formfor forms - ALWAYS wrap validation with
validator(schema)— never rawschema.parse() - Every input MUST have a visible label (via component
labelprop or explicit<label>) - Use domain selectors from
@carbon/formfor foreign key references (Customer, Item, Employee, etc.)
Icon Rules
- ALWAYS use
react-icons/luicons (prefixedLu*) - NEVER use inline
<svg>elements - NEVER use other icon libraries (heroicons, fontawesome, etc.)
Table / Data Display Rules
- Use existing table components from
~/components— don't build custom tables from scratch - Sort and filter controls should use existing patterns from similar pages
Accessibility Rules
- ALWAYS use
focus-visible:for focus states, notfocus: - Dialogs MUST trap focus and support Escape to close
IconButtonMUST always have anaria-label- Interactive elements MUST be keyboard accessible
Boy Scout Rule
When modifying a file, fix any DS violations you encounter on the lines you touch. Don't go out of scope, but don't leave broken patterns on lines you're already editing.
Cross-References
- Full UI conventions:
.claude/rules/conventions-ui.md - Form conventions:
.claude/rules/conventions-forms.md - Component source:
packages/react/src/ - Form components:
apps/erp/app/components/Form/