Projects · compacto-ui
A design system you copy, not install
Two apps had grown the same components by copying files back and forth, and the copies had started to drift. compacto-ui is the one place those components now live: a shadcn-style library you copy from, with a design spec and tooling written for AI coding agents as much as for people.
github.com/sawissac/compacto-uiThe drift problem
Bulky API and waux-ai-studio share a look: the same buttons, dialogs, data tables and palettes. For a while that was done the quick way, by copying a file from one repo into the other. It works until one side fixes a bug or adjusts a border and the other doesn't. A few months in, "the same button" was two slightly different buttons.
compacto-ui is the fix: one repo that holds the source of truth, plus a docs gallery at compacto-ui.vercel.app that shows every component in every palette.
Why it isn't on npm
The obvious move is to publish a package. compacto-ui deliberately doesn't. It works the way shadcn/ui does: you copy a component's source into your app and own it from then on.
That keeps the good part of copying (you can read and change the code in your own repo) while removing the bad part (not knowing which copy is right). The list of what can be copied lives in a single manifest, registry.json, and a build step turns it into one JSON file per component under public/r/, each holding the file contents, where they go, and what they depend on.
What's in the box
Thirty registry items:
- 24 components — button, button group, calendar, command, data table, date picker, dialog, dropdown menu, error boundary, file upload, input, option grid, option list, option palette, popover, progress, resizable, select, separator, sidebar, skeleton, slider, tabs, tooltip.
- 3 helpers —
cnfor class merging,ui-stylesfor shared style recipes, andcolor-themeswith every palette. - Styles — the tokens, theme and texture CSS the components rely on.
palette-provider— a reference React provider that applies a palette.compat-shadcn— an optional bridge for apps still using shadcn's token names (more on that below).
Adding a component
1. Copy it. Point an AI coding agent (or the shadcn CLI) at the repo and name what you want. It reads the item's JSON, pulls in anything that item depends on, and writes each file to its target, by default components/ui/*.tsx and lib/*.ts.
2. Install its packages. Every component needs the base four; some need a peer like cmdk or date-fns, listed in the item's dependencies:
pnpm add class-variance-authority clsx radix-ui tailwind-merge3. Copy the styles once to styles/compacto/, then import them and hand the design system your fonts:
@import "tailwindcss";
@import "./compacto/index.css";
@custom-variant dark (&:is(.dark *));
:root {
--app-font-sans: var(--font-open-sans);
--app-font-title: var(--font-poppins);
--app-font-display: var(--font-poppins);
--app-font-description: var(--font-open-sans);
--app-font-mono: var(--font-jetbrains-mono);
}4. Pick a palette by mounting the provider once:
import { PaletteProvider } from "@/providers/palette-provider";
<PaletteProvider defaultPalette="midnight-dark">{children}</PaletteProvider>;After that, a copied component imports like any local file:
import { Button } from "@/components/ui/button";The design language
The repo ships a DESIGN.md that describes the look on its own terms, so it can be rebuilt in another framework or plain CSS. Its principles are short enough to quote in spirit:
- Flat. No shadows for elevation, no gradients, no glass. Layers differ by surface tone and hairline borders.
- One accent voice. Each palette has exactly one accent hue, used for the primary action, focus rings, selection and links. Success, warning and error are the only other colours.
- Feedback by colour, not motion. Hover changes the fill; a press settles by a pixel; selection changes a border.
- Borders are reserved at rest. Interactive elements keep a transparent 1px border so hover and focus can colour it without the layout shifting.
- Dense but breathable. Controls are 32px tall, body text is 12–13px, labels 11px.
- Two kinds of text. Everything that isn't code is either a title (headings, labels, buttons) or a description (body, help, captions), each with its own font slot.
Twenty tokens, no hex codes
Every colour a component uses is one of twenty --app-* custom properties, exposed to Tailwind as the app-* namespace:
<div className="border border-app-border bg-app-panel text-app-dim" />Three surfaces (bg, panel, sidebar), translucent hover and selected washes that work on any surface, three border strengths, the accent in three intensities, three text levels, two code surfaces, three status colours, and one foreground for solid accent blocks. The rule is simple: a component never hard-codes a hex value.
Twenty-three complete palettes
The palettes cover twelve hues: Midnight, Ocean, Chocolate, Amethyst, Nature, Rose, Amber, Slate, Sunset, Coffee, Cyberpunk and Retro. Each has a dark and a light version except Chocolate, which is light only.
The interesting choice is that a palette is complete on its own. It isn't a light/dark pair laid over a fixed accent; each one sets all twenty tokens and says whether it is light. So component classes never use Tailwind's dark: variant. Applying a palette is a plain mapping:
import { appThemeCssVars, COLOR_THEMES } from "@/lib/color-themes";
const theme = COLOR_THEMES["midnight-dark"];
Object.entries(appThemeCssVars(theme)).forEach(([k, v]) =>
document.documentElement.style.setProperty(k, v),
);
document.documentElement.classList.toggle("dark", !theme.isLight);The .dark class is still toggled, but only for third-party CSS like Monaco, KaTeX and shiki, and for the defaults that paint the first frame before React hydrates. A dark: class in a component fails pnpm conventions, the script that checks the rules ESLint can't express.
Keeping copies in sync
Copying solves the "who owns this code" question but brings back the drift question: how do you know your copy is out of date? compacto-ui answers with two Claude Code skills, installed into the app that uses the library:
| Skill | What it does |
|---|---|
/cui-diff | Read-only. Compares every copied component with upstream and reports each as in sync, outdated (with the diff) or not installed, plus missing packages. |
/cui-sync | Rewrites outdated copies, pulls in missing dependencies, prints the install command for missing packages, then runs a typecheck. |
Both accept specific item names, a --ref branch and a --source path to a local checkout. /cui-sync skips any file with uncommitted local edits unless you pass --force, so a deliberate local change isn't silently overwritten.
Moving off shadcn tokens
An app that already uses shadcn usually has feature code full of bg-primary and text-muted-foreground. Rather than rewrite all of it at once, copy the opt-in compat-shadcn item:
@import "./compacto/compat-shadcn.css";It points shadcn's names at the matching --app-* tokens. Once a search of your source finds no more shadcn token classes, drop the import. The bridge is scheduled for removal in v2.0.0.
Written for agents too
Since the expected way to add a component is to ask an AI coding agent, the repo is written for one to read:
llms.txtis the index an agent reads first.AI-REFERENCE.mdis the exact copy protocol: how to resolve dependencies and where each file goes.DESIGN.mdis the visual spec, for when an agent has to build something new that should sit next to the copied components.CLAUDE.mdis the code-style contract the components follow.
Running the gallery
git clone https://github.com/sawissac/compacto-ui.git
cd compacto-ui
pnpm install
pnpm devThe gallery runs on localhost:3100. There's no CI, so run this before committing. pnpm check chains formatting, lint, typecheck, the conventions script and the registry check:
pnpm check && pnpm buildThe registry check fails if public/r/ is stale, so the manifest and the files people copy can't drift apart either.
compacto-ui is MIT licensed. Browse it live at compacto-ui.vercel.app, or read the source on GitHub.