JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 695
  • Score
    100M100P100Q108039F
  • License MIT

🦉 A cutesy dark mode toggle button for React.

Package Exports

  • react-dark-mode-toggle

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-dark-mode-toggle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-dark-mode-toggle

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

Buy @cawfree a coffee