Understanding Tailwind CSS v4
Admin·
The CSS-First Revolution
Tailwind CSS v4 represents a fundamental shift in how we configure our design system. Gone is the JavaScript tailwind.config.js file — everything now lives in CSS.
New Configuration with @theme
Instead of a config file, you define your design tokens directly in CSS:
@import "tailwindcss";
@theme {
--color-primary: #1a1a2e;
--color-accent: #e94560;
--font-display: "Playfair Display", serif;
}
Performance Improvements
Tailwind v4 is dramatically faster:
- Full builds are 5x faster
- Incremental builds are 100x+ faster
- Powered by a new Rust-based engine using Lightning CSS
Plugin System
Plugins now use the @plugin directive:
@plugin "@tailwindcss/typography";
Migration
Upgrading from v3? Run the automatic migration tool:
npx @tailwindcss/upgrade
It handles most of the conversion automatically. Welcome to the future of utility-first CSS!