Search
 
SCRIPT & CODE EXAMPLE
 

CSS

how to install tailwind for react

1) Install in your project
npm install -D tailwindcss postcss autoprefixer

2) Install tailwindcss and its peer 
dependencies via npm, and then run 
the init command to generate both 
tailwind.config.js and postcss.config.js.
"npx tailwindcss init -p"

3) Configure your template paths.
Add the paths to all of your template 
files in your tailwind.config.js file.

"module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}"

4) Add the Tailwind directives to your CSS
Add the @tailwind directives for each of Tailwind’s 
layers to your ./src/index.css file.
"@tailwind base;"
"@tailwind components;"
"@tailwind utilities;"
Comment

how to properly install tailwind css in react

@import "tailwindcss/base";

@import "tailwindcss/components";

@import "tailwindcss/utilities";
Comment

how to properly install tailwind css in react

npx tailwind init tailwind.js --full
Comment

how to properly install tailwind css in react

npm install tailwindcss postcss-cli autoprefixer@9.8.6 -D
Comment

tailwind css in react

/* ./src/index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
Comment

Setup Tailwind CSS in react-native or react

// tailwind.config.js
module.exports = {
- content: [],
+ content: ["./App.{js,jsx,ts,tsx}", "./src/**/*.{js,jsx,ts,tsx}"],
  theme: {
    extend: {},
  },
  plugins: [],
}
Comment

react tailwind css components npm

// with npm
npm install react-tailwindcss-components
 
// with yarn
yarn add react-tailwindcss-components
Comment

react tailwind css components npm

import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'react-tailwindcss-components';
 
function App() {
  return (
    <Button className="shadow-2xl border-green-400 bg-green-400 rounded font-bold text-white">
      Hello World
    </Button>
  );
}
 
ReactDOM.render(<App />, document.querySelector('#app'));
Comment

tailwind css in react

npx create-react-app my-project
cd my-project
Comment

how to properly install tailwind css in react

const tailwindcss = require('tailwindcss');
module.exports = {
    plugins: [
        tailwindcss('./tailwind.js'),
        require('autoprefixer')
    ],
};
Comment

tailwind css in react

  // tailwind.config.js
  module.exports = {
-   purge: [],
+   purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
    darkMode: false, // or 'media' or 'class'
    theme: {
      extend: {},
    },
    variants: {
      extend: {},
    },
    plugins: [],
  }
Comment

tailwind css and react

/** @type {import('tailwindcss').Config} */ 
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
Comment

how to properly install tailwind css in react

"scripts": {
  "start": "npm run watch:css && react-scripts start",
  "build": "npm run watch:css && react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject",
  "watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
}
Comment

tailwind css in react

// tailwind.config.js
module.exports = {
  purge: [],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}
Comment

how to properly install tailwind css in react

touch postcss.config.js
Comment

setup tailwind css with react

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
Comment

how to properly install tailwind css in react

npx create-react-app react-tailwindcss && cd react-tailwindcss
Comment

PREVIOUS NEXT
Code Example
Css :: input default css properties 
Css :: css filter img color etc 
Css :: how to give opacity to border 
Css :: free computer screen recording software 
Css :: how to remove css from element using jquery 
Css :: stop css transition from firing on page load 
Css :: add notification in css 
Css :: is there any property that reset all atributes css div 
Css :: css media queries laptop 
Css :: css onclick change color 
Css :: css %-px 
Css :: css circle shadow 
Css :: how to change color of a tag in css 
Css :: Apply image as full screen responsive background 
Css :: after icon css 
Css :: Add border to text - Css 
Css :: bulma uppercase 
Css :: use svg icon to before after 
Css :: how to space out buttons css 
Css :: css move element to the right 
Css :: border-width 
Css :: backgroud color css 
Css :: flex-flow 
Css :: Capitalise all first letters of words in a sentence with css 
Css :: grid-template-columns 
Css :: css if select has value 
Css :: overflow in css 
Css :: htaccess file extension 
Css :: how to make a link into normal text css 
Css :: how to apply css when not on hover 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =