Install Tailwind CSS with Create React App - Tailwind CSS
Create your project
npx create-react-app my-project
cd my-project
Install Tailwind CSS
npm install -D tailwindcss
npx tailwindcss init
Configure your template paths in tailwind.config.js
File
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Add the Tailwind directives to your CSS to index.css
file
@tailwind base;
@tailwind components;
@tailwind utilities;
Start your build process
npm run start
Start using Tailwind in your project in App.jsx
export default function App() {
return (
<h1 className="text-3xl text-blue-900 font-bold underline ">
Hello world!
</h1>
)
}
Last Updated : January 27, 2024