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 inithad 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!

Apr 25, 2025 - 06:45
 0

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 inithad me completely lost.

So here’s the step-by-step setup that finally worked for me:

Tailwind v4 Setup with React + Vite

  1. Create your Vite + React project:
    npm create vite@latest my-app -- --template react
    cd my-app

  2. Install Tailwind CSS v4 with Vite plugin:
    npm install -D tailwindcss@latest @tailwindcss/vite

  3. Create and edit src/index.css:
    @import "tailwindcss";

  4. 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()],
});
  1. Make sure main.jsx imports ./index.css

  2. Test it in App.jsx:

function App() {
  return (
    

Hello Tailwind v4!

); }
  1. Run your dev server: npm run dev

✅ And you’re all set with Tailwind v4 running in your React app using Vite!