Tailwind CSS and Vue 3 form a powerful combination for building modern, responsive user interfaces. Here’s how to integrate them:
Step 1: Install Tailwind CSS
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init
Step 2: Configure Tailwind
Update tailwind.config.js:
module.exports = {
content: ['./src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
extend: {},
},
plugins: [],
};
Step 3: Include Tailwind in Your App
Add Tailwind to your src/main.css:
@tailwind base; @tailwind components; @tailwind utilities;
Step 4: Use Tailwind in Components
<template>
<div class="bg-blue-500 text-white p-4 rounded">
Hello, Tailwind with Vue 3!
</div>
</template>