tailwind-theme-toggle-buttons
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published
npm install tailwind-theme-toggle-buttons

or

yarn add tailwind-theme-toggle-buttons

Usage

Step 1.

tailwind.config.js

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

Step 2.

import Toggle from "tailwind-theme-toggle-buttons";

export default function App() {
  return (
    <div>
      // button style 1
      <Toggle style="A" />

      // button style 2
      <Toggle style="B" />

      // button style 3
      <Toggle style="C" />
    </div>
  );
}

OR You can use your custom button

import { toggleFunc } from "tailwind-theme-toggle-buttons";

export default function App() {
  return (
    <div>
      <button onClick={toggleFunc}>Toggle</button>
    </div>
  );
}

Also you can check theme

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

Package Sidebar

Install

npm i tailwind-theme-toggle-buttons

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

15.9 kB

Total Files

4

Last publish

Collaborators

  • stacksagar