Tailwind CSS v4 — First Look
Tailwind CSS v4 rewrites the configuration model. No more tailwind.config.js — everything lives in CSS. Here's what changed and what I think about it.
Tailwind CSS v4 is a significant rewrite. The core utility classes are the same, but the configuration model is completely different. Here’s my first look after using it on this website.
What Changed
No More tailwind.config.js
In v3, you’d have a JavaScript config file:
// tailwind.config.js (v3)
module.exports = {
darkMode: 'class',
theme: {
extend: {
colors: {
brand: '#6366f1',
},
fontFamily: {
sans: ['Inter', 'system-ui'],
},
},
},
plugins: [require('@tailwindcss/typography')],
};
In v4, all of this moves to CSS:
/* styles/global.css (v4) */
@import "tailwindcss";
@plugin "@tailwindcss/typography";
@variant dark (&:where(.dark, .dark *));
@theme {
--color-brand: #6366f1;
--font-sans: 'Inter', system-ui, sans-serif;
}
Vite Plugin Instead of PostCSS
v3 used PostCSS. v4 uses a Vite plugin (for Vite-based projects):
// vite.config.js (v4)
import tailwindcss from '@tailwindcss/vite';
export default {
plugins: [tailwindcss()],
};
The PostCSS plugin still exists for non-Vite projects.
CSS-First Configuration
The @theme block in CSS defines design tokens as CSS custom properties. These become Tailwind utility classes automatically:
@theme {
--color-brand: #6366f1;
/* becomes bg-brand, text-brand, border-brand, etc. */
--font-display: 'CalSans', sans-serif;
/* becomes font-display */
--spacing-18: 4.5rem;
/* becomes p-18, m-18, gap-18, etc. */
}
This is genuinely elegant. Design tokens defined once, available everywhere.
What I Like
Faster builds. The new engine using Rust under the hood is noticeably faster. Cold start on my project went from ~800ms to ~200ms.
CSS variables by default. Every design token is a CSS custom property. This makes runtime theming much easier — just update a variable, and everything that uses it updates.
Simpler dark mode. Configuring class-based dark mode with @variant dark in CSS feels more natural than the darkMode: 'class' config option.
What Takes Getting Used To
No config file. I keep instinctively reaching for tailwind.config.js. It’ll take a few projects to break that habit.
Plugin syntax. @plugin "@tailwindcss/typography" in CSS looks a bit unusual, but it works.
Breaking changes. If you’re upgrading from v3, there are breaking changes. Some class names changed (e.g., shadow-sm → shadow-xs). The migration guide is thorough but it’s still work.
Should You Upgrade?
For new projects: yes. The CSS-native config is cleaner, builds are faster, and the mental model is simpler.
For existing projects: wait or plan carefully. The breaking changes require attention, and the tooling is still maturing.
I used v4 for this website (a new project) and the experience has been great. The faster build times alone are worth it.