How to use material - tailwind in vite - react

npm install -D tailwindcss postcss autoprefixer


npx tailwindcss init -p


Paste below code in tailwind.config.js


/** @type {import('tailwindcss').Config} */

export default {

  content: [

    "./index.html",

    "./src/**/*.{js,ts,jsx,tsx}",

  ],

  theme: {

    extend: {},

  },

  plugins: [],

}




Paste below code in index.css


@tailwind base;

@tailwind components;

@tailwind utilities;


Remeber to wrap the main.jx inside theme provider


Now go to https://www.material-tailwind.com/docs/react/guide/vite


npm i @material-tailwind/react


const withMT = require("@material-tailwind/react/utils/withMT");

 

module.exports = withMT({

  content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],

  theme: {

    extend: {},

  },

  plugins: [],

});

Comments