Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

cawfree/react-dark-mode-toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-dark-mode-toggle

Hello! 👋 This package is now deprecated. Please migrate over to react-dark-mode-toggle-2.

A super cutesy dark mode toggle button for React. Inspired by overreacted.io.

code style: prettier

🚀 Getting Started

Using npm:

npm i react-dark-mode-toggle

Using yarn:

yarn add react-dark-mode-toggle

✨ Usage

import React, {useState} from "react";
import DarkModeToggle from "react-dark-mode-toggle";

export default () => {
  const [isDarkMode, setIsDarkMode] = useState(() => false);
  return (
    <DarkModeToggle
      onChange={setIsDarkMode}
      checked={isDarkMode}
      size={80}
    />
  );
};

📌 Props

Prop Type Default Required
onChange func value => null No
checked boolean false No
size number (defaults to px) or string (px, em, rem, %, etc.) 85 No
speed number 1.3 No
className string null No

Note, this is not a dark mode theme implementation; it's just a button! You'll need to mix this with a management solution such as use-dark-mode.

✌️ License

MIT

About

🦉 A cutesy dark mode toggle button for React.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published