@qvgk/react-toggle-theme
TypeScript icon, indicating that this package has built-in type declarations

1.4.3 • Public • Published

React Toggle Theme

Reformed by QVGK

About React Toggle Theme

React Toggle Theme was a React component originally created by forgng.

I saw that it had many issues that weren't getting fixed, so I decided to take it into my own hands and "reform" the module. I took out all packages that weren't needed, and fixed the ones that still remained. Then, I took the original code for the switch and put it here.

Oh, and I had to learn some TypeScript for this. You're welcome.

Installation

yarn add @qvgk/react-toggle-theme
npm install @qvgk/react-toggle-theme

Usage

import React, { useState } from "react"
import ToggleTheme from "@qvgk/react-toggle-theme"

export default function App() {
  const [currentTheme, setCurrentTheme] = useState("light")

  return (
    <div style={{ backgroundColor: currentTheme === "light" ? "#000" : "#fff" }}>
      <ToggleTheme selectedTheme={currentTheme} onChange={setCurrentTheme} />
    </div>
  )
}

Package Sidebar

Install

npm i @qvgk/react-toggle-theme

Weekly Downloads

0

Version

1.4.3

License

MIT

Unpacked Size

14 kB

Total Files

8

Last publish

Collaborators

  • qvgka