Skip to content
Control UIalpha
Skill / UI / Tailwind

Tailwind v4 CSS configuration

Configure Tailwind through CSS directives and tokens instead of adding new JavaScript config.

Goal

Keep Tailwind configuration CSS-first so tokens, utilities, variants, sources, and `@apply` references stay in the stylesheet the build actually reads.

Styling rules for Tailwind v4, token discipline, component reuse, and className boundaries.

Checks

1Check the pinned `tailwindcss` version before relying on a recent utility or directive; at the time this rule was added, the docs app resolved Tailwind 4.3.2.
2Use `@import "tailwindcss"`, `@theme`, `@utility`, `@custom-variant`, `@source`, `@variant`, and `@reference` for new configuration.
3Put utility-generating tokens in `@theme`; use plain CSS variables for runtime-only values that should not generate classes.
4Use `@theme inline` when a token value references another variable so generated utilities resolve at the declaration site.

Avoid

1`@tailwind base/components/utilities`, new `tailwind.config.ts` work, JS plugins, `addVariant`, content arrays, or safelist config for new v4 code.
2The v3 `theme()` function or `resolveConfig` for runtime styling decisions; use CSS variables, `--alpha(...)`, and `--spacing(...)`.

Source

Imported as local Control UI skill guidance, with this repo owning the final wording.

Mastra tailwind-v4
../mastra/.claude/skills/tailwind-v4