Skip to content
Sahil Durgia/ full-stack
2 min readCSS & Tailwind

Building a Consistent Design System With Tailwind CSS

Tailwind's default scale IS the design system for most projects — the real skill is knowing when to constrain it further, not abandon it for something custom.

Tailwind CSSdesign systemsdesign tokens

"We need a design system" often turns into months of building custom tooling to solve a problem Tailwind's default configuration already mostly solves — a constrained, consistent scale for spacing, color, and typography, enforced structurally rather than by a style guide document nobody reads consistently.

Tailwind's scale IS a design system, out of the box

The spacing scale (`p-1` through `p-96`, each a fixed, deliberately chosen value) means a developer literally cannot write an arbitrary, off-scale padding value without reaching for Tailwind's explicit arbitrary-value escape hatch (`p-[13px]`) — which stands out in a code review specifically because it looks different from everything else, making an inconsistent choice visible rather than silently blending in the way a hand-typed `padding: 13px;` would in plain CSS.

Where this site's own token system extends it

@theme {
  --color-accent: #b5abfc;
  --color-ink-muted: #9a9aa3;
  --color-border-strong: #66666f;
}
/* Real, named, semantic tokens — not Tailwind's generic gray-500 —
   defined once, used everywhere via bg-[var(--color-accent)] */

Tailwind v4's `@theme` block (CSS-first configuration, no separate config file) is where a project layers its own specific design language on top of Tailwind's scale — semantic color names (`--color-accent`, `--color-ink-muted`) instead of generic ones (`purple-400`, `gray-500`), so a color's *meaning* is named once, centrally, and every usage across the codebase automatically stays in sync if that meaning's actual value ever needs to change.

The actual skill: constraining further, not abandoning the system

A mature Tailwind design system usually adds MORE constraint on top of Tailwind's defaults, not less — a fixed set of button variants instead of composing utilities freely every time, a documented set of the 6-8 actually-used spacing values instead of the full scale being available everywhere. The discipline isn't "use Tailwind"; it's "decide, deliberately, which subset of Tailwind's full flexibility this specific project actually needs" — the same principle as any design system, expressed through Tailwind's tooling instead of a hand-rolled one.

Keep reading
Next: dark mode done right

Part 10 of the CSS and Tailwind series.