Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
Tailwind CSS v4 simplifies setup a lot: you can start with a single CSS import and zero configuration. The recommended setup depends on your build tool.
Recommended: Vite plugin
If your project uses Vite (React, Laravel, SvelteKit, Solid, etc.), the Vite plugin is the easiest path:
- Install Tailwind and the Vite plugin:
npm install tailwindcss @tailwindcss/vite
- Add the plugin to
vite.config.ts(or.js):
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [
tailwindcss(),
],
})
- Import Tailwind in your CSS entry file (for example
src/index.css):
@import "tailwindcss";
- Run your dev server:
npm run dev
That’s it. Start using Tailwind classes in your HTML.
Not using Vite? Use the PostCSS plugin
If your setup relies on PostCSS (for example Next.js), use the official PostCSS plugin instead:
- Install Tailwind and the PostCSS plugin:
npm install tailwindcss @tailwindcss/postcss postcss
- Add the plugin to
postcss.config.mjs:
export default {
plugins: {
"@tailwindcss/postcss": {},
},
}
- Import Tailwind in your CSS entry file:
@import "tailwindcss";
- Run your build/dev command (
npm run dev,npm run build, etc.).
Automatic content detection (no config required)
Tailwind v4 auto-detects the files where you use classes, so a content array is not required. If you need to include sources that are ignored by default, add them with @source in your CSS:
@import "tailwindcss";
@source "../vendor/**/*.blade.php";
Framework-specific guides
If you use a framework, prefer the official guides (Laravel, Next.js, Remix, etc.) because they include framework-specific details about where to put the CSS import and how to wire your build.
- Tailwind docs: https://tailwindcss.com/docs/installation