@gener8v/tailwind-preset
Tailwind v4 @theme generated from the same tokens as the stylesheet, so utilities and the
component layer can never disagree.
npm i @gener8v/tailwind-preset # public on npm, MIT
@import "tailwindcss";
@import "@gener8v/tailwind-preset/theme.css";
Then bg-action, p-6, rounded-md, text-2xl resolve to the system's values rather than
Tailwind's defaults.
The word "contents"
Tailwind v4 generates display: contents for any source file that contains the word "contents"
(prose, a comment, a variable). That utility strips the box from the system's Contents
component. theme.css therefore carries @source not inline("contents");, so the utility is never
generated and you need no line of your own. If you do want Tailwind's contents utility, add
@source inline("contents"); after the preset import. The component also keeps its box with
nav.contents, .contents-nav { display: block }.
When to use a utility and when not to
Prefer the semantic classes for anything the system already names. .btn, .card,
.tag, .panel, .field — these carry states, focus treatment and accessibility styling
that a stack of utilities will not reproduce, and rebuilding a button out of bg-action px-4 py-2 rounded-md gets you something that looks like a button and behaves like a div.
Utilities are for layout the system does not cover: a one-off grid, a gap, a max-width on a page section. That is the line.
Why this exists at all
The system's own components use semantic classes, not utilities. This preset is here so a consuming repo already standardised on Tailwind can lay out pages with familiar utilities without hard-coding a single value — and so those utilities resolve to the same numbers the components use. It is a bridge, not the primary interface.
What is generated
Colours (every ramp step and role), spacing, the type scale, radii, shadows and motion — the
same values as @gener8v/tokens. theme.css is generated by pnpm build:tokens; never
hand-edit it, and CI will fail if you do.