how to setup tailwind for reactjs

1. npx create-react-app .

2. npm i -D tailwindcss postcss-cli autoprefixer 
or
npm install tailwindcss@latest postcss@latest autoprefixer@latest
//postcss - transform our compile css 
// autoprefixer - set vendor prefixes within our css automatically when needed

//Generate npc config file
3.npx tailwind init tailwind.js --full

// Create post css config file
4. touch postcss.config.js

//open postcss.config.js
//add this to the file
__________________________________________
const tailwindcss = require('tailwindcss');
module.exports = {
  plugins: [
    tailwindcss('./tailwind.js'),
    require('autoprefixer')
  ]
}
__________________________________________

5. inside scr, create assets folder src/assets
- create tailwind.css and main.css

in tailwind, add this code
//this will compile to the main css that will include in our app
___________________________________________
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
___________________________________________

6. Open package.json and add this iside the scripts
___________________________________________
   "start": "npm run watch:css && react-scripts start",
    "build": "npm run build:css && react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "build:css": "postcss src/assets/tailwind.css -o src/assets/main.css",
    "watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
____________________________________________
7. run 'npm start'


add this to index.js
_____________________________________
import React from 'react';
import ReactDOM from 'react-dom';
import './assets/main.css';
import App from './App';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);
_________________________________


install router

1. npm i --save react-router-dom

4.75
4
Chib 60 points

                                    npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

4.75 (4 Votes)
0
3.8
10

                                    npm install tailwindcss

3.8 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
using tailwind with react js add tailwind react app add tailwind react project setup tailwind react how to create tailwind plugin react using tailwind with react components how to install tailwind in create react app using tailwind without react npm install tailwindcss in react usign tailwind in react react project with tailwind using tailwind with create react app using tailwind without create react app install tailwind css for react tailwind install in react how to import tailwind components in react create react project with tailwind Installing tailwindcss in react tailwind react getting started how to start tailwind in react how top set up react with tailwind npm @nrwl/react/tailwind configure tailwind with react tailwind add to react install react tailwind tailwind in reactjs react add tailwind how to setup react with tailwind react create react app with tailwind how to build a react app with tailwind tailwind react js tailwind in react import tailwind into react installing tailwind for react apps react create new app with tailwind how to easily setup tailwind to react tailwind react starter kit reactjs react installation tailwind create react tailwind app how can add tailwind to react for react.js tailwind react with tailwind ui how to add tailwind to react vite add tailwind to react app how to setup tailwind for vite react app adding tailwind to a react site tailwind to create react app tailwind react library creation tailwind react library jual tailwind react react tailwind setup how to build react app with tailwind integrating tailwind withb react tailwind to react jsx how to start tailwind react app react tailwind example tailwindo react create tailwind as components react react tailwind started npx create react app with tailwind install tailwindcss with react create react app add tailwind tailwindinstall create react app setup react with tailwind css using tailwind react tailwindcss react app How to setup tailwind in a react project project with tailwind and react react app tailwind use react without create react app and tailwind reactjs tailwind setup install react with tailwind css tailwind use in react install tailwindcss in react js install tailwindcss react application setting up tailwind and react react tailwind package react import tailwind add tailwind to reactr react js with tailwind create react app tailwindcss tailwind in react project tailwind react example create a tailwind react app setup tailwind in react set up tailwindcss react install tailwind in react js how to setup tailwind in react is tailwind for react install tailwind reactjs installing tailwinds in react import tailwind reactjs how to use tailwind with react setup tailwind on reactjs add tailwind to create-react-app add tailwind in react project npx create-react-app tailwind template can i use tailwind with react learn tailwind with react add tailwind in react js tailwind with react tutorial tailwind react syntax tailwind start react js npm install tailwindcss react tailwind react download install tailwind ui react install tailwind create react app configuring tailwind for react application how to install tailwind in react using npm how to install tailwind in react react and tailwind setup create react app with tailwindcss tailwind + react is tailwind is useful for react js import js in react tailwind how to use tailwind in react tailwind react tutorial create react app tailwind build does tailwind work well with react react install tailwind to do with tailwind and react react npm install tailwind tailwind with react js how to setup tailwind for reactjs tailwind css install react installer tailwind app react use tailwind in react install tailwind in react app setting up tailwind with react tailwind npm install react use tailwind with react add tailwind to reacty install tailwindcss create-react-app adding tailwind in react create react app tailwind 2 tailwind install create react app create react app install tailwind tailwind css react install adding tailwind to reactjs tailwind using create react app tailwind setup in react install tailwind with react create react component tailwindcss how to set up tailkwind to react app using tailwind and react react create app tailwind how to install tailwind with react how to add tailwind to react project adding tailwind to react app tailwindcss react install How to set up react project with tailwind react tailwind cs install build react components with tailwind setup react with tailwind how to import tailwind css in react instalar react wind install tailwindcss in react tailwind react login react tailwind tutorial react cra filestructure tailwind react tailwind custom add css react tailwind add css headliessui react tailwind create react app and tailwind how to put tailwindcss in a reactjs Install Tailwind CSS with Create React App tailwind setup react tailwindcss create react app tailwind in react example react and tailwind project react app with tailwind tailwindcss into react create react app with tailwind css tailwind css with create-react-app npx create-react-tailwind-app steps form tailwind and react integrate tailwind with react tailwind not starting up in react app using tailwind them values in jsx tail wind css react tailwindcss react exmaple how to fix tailwind support for jsx reactjs tailwind to Styles react public url in tailwind config reactjs tailwind scss tailwindcss Create React APp with type MOdules tailwind react js style @pply config tailwind for CRA tailwnd css reactjs variable tailwind install react better way to code tailwind css in react recompile css tailwind react installing tailwing dont work react how to install properly tailwind in react tailind in react how to properly install tailwind css in react React tailwind class type how to use tail-wind react please install postcss 8 or above create react app please install postcss 8 or above tailwind cra tailwind css react integration taolwond setup react reactjs tailwind email components errors how to add tailwindcss with create react app react project tailwindcss not working create react app postcss 8 bootstrap react tailwind compile a tailwind react project tailwind react install tailwind css react website react tailwind css setup set up react tailwindcss reacat and tailwind css tailwindcss not loading in production react tailwind css react example how to use tailwind css with react tailwind css reactjs react + tailwind tailwindcss full example react setup tailwind with react use tailwind with create react app how to compile tailwind.config file on save react tailwind watch css how to inject tailwind css into js react and tailwind setup not working react and tailwind tailwind css 2 + react tailwind2 react react js teilwine css tailwind css react in react configure tailwind in a react project creatye react app with tailwind exemple react with tailwind installing tailwind react tailwind in jsx tailwindcss react project add tailwind react how to reusetailwind css in react install tailwind react use tailwind css with react configure react with tailwind css tailwind without react tailwind css in reatc tailwind @apply not working react app tailwind react app reactjs tailwind tailwind css vs react js tailwindcss vs reactjs setup react app with tailwind css tailwindcss reactjs setup tailwindcss v2 with react tailwind react css tailwind jsx tailwind react.js reactjs tailwind possible? tailwind css in react tailwind 2.0 with react install tailwindcss with create-react-app React file upload using tailwind tailwind equivalent for react tailwin for react tailwind not working react tailwindcss react deploy app tailwind css and react how to install tailwind css react tailwind on reactjs tailwind css with setup react and tailwindcss using tailwindcss with react how to use npm tailwindcss in reactjs install tailwindcss in cra setup tailwind with react 2020 tailwind css react tutorial production build tailwindcss react customize tailwind react steps to set up tailwindcss in your react project install tailwind javascript react install tailwind css react tailwind for react js tailwindcss in react js setup how to install tailwindcss in reac tailwind css in react js setup tailwind css in react js how to add tailwind to react create react app, tailwind add tailwind to react project react scripts with tailwind css add tailwindcss to react reactjs with tailwindcss create react app &amp; tailwind tailwind css for react how to dynamically render 2 images with tailwind taiwind react how to build react with tailwind samll app in react with taliwind build tailwind react project how to set up tailwind css in create react app react tailwind css install tailwind react setup setup tailwind css with react tail wind form react tailwind css react ejected tailwind cra build setting up tailwind and react project react app install tailwind postss react app install tailwind how to add tailwind css to react tailwind config wont update react app setup react with tailwindcss postcss-import tailwind notworking in react project react + tailwind + 7 in 1 tailwind for reactjs reactjs tailwind css adding tailwind to react tailwind react watch how to set up tailwind with react import tailwind css react tailwind in jsx format react tailwindcss react tailwind css how to import tailwind in react how to install and import tailwindcss in react how to create a react app with tailwind why tailwind css is not being applied on react app how to install tailwind css in react how to use utilities css react css utilities react how to use tailwind css in react install tailwind on react tailwind for react how to use talwind css in react using tailwind in react tailwind a tag style react tailwind code completion react tailwind on react create react app tailwind tailwind css create react app install tailwind to react react and tailwind errors react tailwind install add tailwind to react add tailwind to mpx create react js using tailwind with react setting Tailwindcss on react install tailwind into a react project 2020 cant install tailwind onto react how to add img in tailwind react tailwind css config react tailwind css react setup create react app with tailwind tailwind create react app react css in js with tailwindcss how to use last-child of tailwind in reactjs how to use pseudo-class of tailwind in reactjs tailwindcss in react how to add tailwind in react and skip create-react-app how to install thailwind in react postcss tailwind react tailwind css react production build react build tailwind css react js tailwind Tailwind CSS &amp;&amp; react not able to install tailwind in react tailwindcss and scss in react setting up tailwind css in a react project style react &lt;Link&gt; tailwind style react &lt;Link&gt; tailwaind ignore tailwind base styles react can i use tailwind css with react add tailwind to create react app how to get css tailwind on react react with tailwind css tailwind with react react add tailwindcss tailwind with react tailwindcss with react tailwind css not working react how to configure tailwind css for react react tailwind sign up example react tailwind sign in tailwinds react tailwind in react tailwind css with react install tailwind in react tailwindcss react tailwind react custom css tailwind react setup tailwind css with create-react-app ty[es\\ make an embed taller using tailwind cssin react tailwind css react react and tailwind css react tailwind tailwind and react
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source