Work/CotonAI Design System

Case study ( 03 ) ยท CotonAI

CotonAI Design System

Building a design system from scratch for an AI canvas: one token file that designers, engineers and AI agents all build from.

Company
CotonAI
Tools
Paper, Tailwind, Storybook
Role
Founding Product Designer
Deliverables
Token source, Paper library, Agent rules
Status
Tokens and Paper library built, components not yet in code

Overview

CotonAI is an AI canvas for fashion teams. I joined as founding product designer in August 2025 and own the design system. Three kinds of builder use it: designers working in Paper, engineers working in Tailwind, and AI agents that draft UI code.

I treated the system as a design problem and ran a double diamond. I audited the codebase first, then defined the question, then made one token file the source. Stage 1 of 4 is applied, so every number here is a stage 1 number.

The process as a double diamond across Discover, Define, Design and Validate. Research: audit the codebase for raw colour, size and controls, read both token sources, check contrast on every text pair. Research findings: count and map the drift, list what fails WCAG AA. Define the right HMW: how might we make the right colour the easiest one to use, and group the findings by cause. Potential solutions: generate the palette in OKLCH, let contrast choose the blue, draft six base shells in Paper. Implementation: one token file that generates code and Figma tokens, a Paper library and agent rules, and gates that fail the build.
The process, drawn in Paper

Discover & Define

The first job was to find out what the interface was really made of. I audited the src folder on 11 November 2026 and checked every text pair for contrast.

The cause was a missing source. Colour, size and controls were decided again in every file.

  • 1,411raw hex colours in 187 files
  • 490raw buttons, while only 5 files import Button
  • 669arbitrary text sizes, like text-[13px]
  • 10files build their own dialog, sheet or drawer
  • 7shadcn components imported nowhere
  • 3.5:1contrast of the old muted gray on white

Here's what that caused

Reading both token sources side by side showed five problems.

  1. Two files defined colour and disagreed: shadcn's HSL variables in index.css against hex in boardUiTokens.ts, which 106 files import.
  2. Buttons and overlays were rebuilt in each file instead of reused.
  3. Sizes were decided file by file, so type drifted too.
  4. Nothing checked contrast, so a gray that fails AA shipped.
  5. Changing one shape would touch about 106 files.
How might we

Make the right colour the easiest one to use?


Design & Validate

Five principles shaped every decision. Each one is something a person or a machine can check.

Generated

One JSON file, cotonai.tokens.json, is the only file edited by hand. It generates the CSS variables, the Tailwind theme, a TypeScript module and the Figma import files.

One file in, every output generated

Semantic

Components read roles such as bg-surface and text-muted, never raw values. Primitives only define the roles. The palette is generated in OKLCH, with the brand blue, red and purple pinned.

Paper: semantic colour, light theme

Themed

Light and dark use the same names, so a component never changes structure between themes. Swapping the token set is the only difference.

Paper: one surface, two themes

Interactive

Default, hover, pressed, focus and disabled are drawn for every component. The demo runs the real components on the real tokens, and Before and After swaps in the old token set.

Live: the same components on the old tokens and the new

Accessible

Contrast is a failing check. 250 of 250 text and UI pairs meet WCAG 2.2 AA, and the gate also fails if a generated file is stale.

The gates, as run on 11 November 2026

Design System Structure

The Paper file has four pages: seven Foundations boards, 35 component artboards, 13 patterns and an Index that says which component to use for which job. Six base shells sit under the components. They are designed in Paper and not built in code yet.

Paper: the Index page
Paper: six bases, and which components wear each

Design Token

Tokens are split by how widely they apply. A change at the bottom reaches everything above it. One example per layer.

Primitive tokens

97 raw values: one neutral ramp and five hues, generated in OKLCH. Never used directly in components.

Semantic tokens

105 roles per mode, light and dark. This is what components use.

Component tokens

Only where a component truly differs from the semantic set, such as nav and toggle colours.

Dimensions

100 variables for spacing, radius, size, type, opacity, duration and layers, plus 7 effects.