1.0.9 • Published 1 year ago

tailwind-theme-toggle v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago
npm install tailwind-theme-toggle

or

yarn install tailwind-theme-toggle

Usage

Step 1.

// tailwind.config.js

module.exports = {
  darkMode: "class",
  // others
};

Step 2.

in React.s/Next.js

Recommended this package for react/nextjs project, click here

import themeToggler from "tailwind-theme-toggle";

const Button = () => <button onClick={themeToggler}> Toggle </button>;
in Vue.js/Nuxt.js
import themeToggler from "tailwind-theme-toggle";

<button @click="themeToggler">Greet</button>
in raw HTML/JavaScript
import themeToggler from "tailwind-theme-toggle";

const button = document.getElementById("togglerButton");
button.addEventListener("click", themeToggler);

Also you can check theme

const theme = localStorage.getItem("theme");
const isDark = theme === "dark";
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago