Compose, Don't Author
The Utility-First Mindset
Instead of inventing class names and writing CSS rules, you compose pre-made utilities directly on elements.
What you'll learn
- Build a card with utilities only
- Understand why this approach scales
- Address the "ugly HTML" objection
The hard part of CSS was never the properties — it was the naming and the bookkeeping. Utility-first removes both: you stop authoring rules and start composing existing ones.
The Traditional Way
Classic CSS asks you to invent a vocabulary first:
.card {
border-radius: 0.75rem;
border: 1px solid #e5e7eb;
padding: 1.5rem;
box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
} Now you maintain a .card name, a CSS file, and the mental link between them. Multiply by every component.
The Utility-First Way
Skip the rule entirely — describe the design inline:
<div class="rounded-xl border p-6 shadow-sm">
<h2 class="text-lg font-semibold">Quarterly report</h2>
<p class="mt-2 text-gray-600">Revenue grew 18% this quarter.</p>
</div> Why this scales:
- No dead CSS — deleting the markup deletes the styling. Stylesheets never grow stale.
- No naming — you never debate
.cardvs.panelvs.box. - Consistent scale —
p-6,text-lg, androunded-xlcome from one design system, so spacing and type stay in rhythm. - Local reasoning — what you see is what you get; no cascade surprises from a selector three files away.
The “Ugly HTML” Objection
Yes, the class list is long. But that string is not duplicated noise — it is the design, made explicit and local. When a class list repeats across many elements, you do not reach for a CSS class; you extract a component (a function or partial) in your framework. That keeps a single source of truth in markup, where the rest of the component already lives. We will cover extraction patterns in a later section.
The Build Pipeline & Oxide Engine →