react-context-api-theme-switcher Tailwind Templates

React Context Api Theme Switcher

React, Vite, Tailwind, Card, Theme Switcher, Context API

React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

npm create vite@latest
 cd react-context-api-theme-switcher
  npm install
  npm run dev

Install Tailwind CSS Install tailwindcss and its peer dependencies, then generate your tailwind.config.js and postcss.config.js files.

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Configure your template paths

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

Add the Tailwind directives to your CSS

@tailwind base;
@tailwind components;
@tailwind utilities;

Restart Server

  npm run dev

Top categories

Loading Svelte Themes