Getting Started with Tailwind CSS v4 in Next.js
Tailwind CSS v4 introduces a fully CSS-first configuration and massive speed improvements. Here is how to make the most of it in Next.js.
Tailwind CSS v4.0 is here, and it represents a massive paradigm shift. The Javascript-based tailwind.config.js is gone, replaced entirely by native CSS-first configuration using @theme and @import.
Key Features in Tailwind v4
- **Rust Engine**: Tailwind v4 is built using a custom Rust compiler, making builds up to 10x faster.
- **CSS-First Configuration**: Configure your colors, fonts, and breakpoints directly inside your CSS file using the @theme directive.
- **Automatic Content Detection**: You no longer need to write a `content` array detailing your JSX/TSX paths. Tailwind automatically scans your project.
Setting it up in Next.js
In Tailwind v4, installation is incredibly simple:
/* globals.css */@theme inline { --color-paper: #faf6ea; --color-ink: #3b3832; --color-mustard: #a98c3f; } ```
All theme utilities are instantly available as standard Tailwind utility classes. This drastically simplifies the project setup and makes customization intuitive.
Why this is a game changer
CSS is once again the source of truth for styling. By utilizing CSS variables under the hood, Tailwind v4 bridges modern browser standards with utility-first speed, making it cleaner than ever to create premium, customized UI themes.