guide
A complete guide to Tailwind CSS v4 covering breaking changes, the new engine, simplified configuration, and how to use it correctly in Next.js App Router projects.
Tailwind CSS v4 is not just an incremental update.
It’s a fundamental re-architecture of how Tailwind works:
If you upgrade without understanding the changes, you will run into confusing issues.
This guide exists to prevent that.
Tailwind v4 introduces a brand-new internal engine.
What this means:
For most projects, Tailwind now works with almost zero configuration.
One of the biggest surprises in v4:
👉 You don’t need a tailwind.config.js file anymore
Tailwind ships with:
You only create a config file if:
In Tailwind v3, you had to do this:
content: ["./app/**/*.{js,ts,jsx,tsx}"];In v4:
Tailwind’s base styles (Preflight) have been refined.
Notable changes:
If you relied on browser quirks, you may notice small visual differences after upgrading.
The recommended setup is simpler than ever.
npm install tailwindcss@latest postcss autoprefixerIn app/globals.css:
@import "tailwindcss";That’s it.
No directives. No layers. No config file required.
Tailwind v4 is designed for the App Router.
It works seamlessly with:
Example:
export default function Page() {
return (
<main className="mx-auto max-w-4xl p-6">
<h1 className="text-3xl font-bold">Hello Tailwind v4</h1>
<p className="text-muted-foreground mt-2">
Styling with zero config.
</p>
</main>
);
}If you need customization, create tailwind.config.ts:
import type { Config } from "tailwindcss";
export default {
theme: {
extend: {
colors: {
brand: "#16a394",
},
},
},
} satisfies Config;Tailwind v4 merges this on top of its defaults — you no longer need to redefine everything.
Plugins still work, but:
This keeps builds fast and CSS minimal.
Dark mode defaults are unchanged, but v4 encourages:
Example:
<div className="bg-background text-foreground">
Content
</div>This pairs perfectly with modern Next.js theming strategies.
Tailwind v4 works best when you trust it first.
Tailwind v4 is ideal for:
Tailwind CSS v4 is:
Once you embrace:
You’ll spend less time tweaking styles and more time building real features.
Tailwind v4 doesn’t remove control — it removes busywork.
I share new articles, insights, and experiments in modern web development. No spam — just useful content.