className in JSX.npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
# will create tailwind.config.js and postcss.config.js
styles/globals.css
@tailwind base; /* resets + base styles */
@tailwind components; /* reusable components */
@tailwind utilities; /* all utility classes */
export default {
content: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {
colors: {
brand: '#1c64f2',
},
spacing: {
128: '32rem',
},
},
},
plugins: [],
}
<div class="bg-blue-500 text-white p-4 rounded-lg">
Hello Tailwind
</div>
<!-- bg-blue-500 → background color -->
<!-- text-white → text color -->
<!-- p-4 → padding -->
<!-- rounded-lg → border-radius -->