If you're starting with Tailwind CSS v4, you might’ve noticed:
most tutorials and videos are still stuck in the old version. I faced it too—docs didn’t help much, and outdated commands like tailwindcss init
had me completely lost.
So here’s the step-by-step setup that finally worked for me:
✅ Tailwind v4 Setup with React + Vite
Create your Vite + React project:
npm create vite@latest my-app -- --template react
cd my-app
Install Tailwind CSS v4 with Vite plugin:
npm install -D tailwindcss@latest @tailwindcss/vite
Create and edit src/index.css:
@import "tailwindcss";
Update vite.config.js:
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [react(), tailwindcss()],
});
Make sure main.jsx
imports ./index.css
Test it in App.jsx:
function App() {
return (
Hello Tailwind v4!
);
}
- Run your dev server:
npm run dev
✅ And you’re all set with Tailwind v4 running in your React app using Vite!
😅 Want to Hear the Chaos Behind This?
If you’re curious about how I actually figured this out—confusion, outdated guides, broken commands, Discord help, and even ChatGPT misfires—I wrote a separate blog post on my full struggle story in Medium.
👉 Read: 💻 My Tailwind CSS v4 Setup Struggle
Hope it helps another beginner avoid the same mess I went through! 💙