Anonymous View
Skip to content

mathdroid/react-moon-toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

react-moon-toggle

Toggle dark mode (or anything) in moon phases emoji

Usage

import React from "react";
import Toggle from "react-moon-toggle";

const app = () => {
  const [dark, setDark] = React.useState(false);

  return <Toggle {...{ dark, setDark }} />;
};

Installation

$ yarn add react-moon-toggle

Props

  • dark boolean (required)

  • setDark = (newDark: boolean) => null ?function

  • interval = 50 number

  • darkIndex = 0 number (0-7)

  • lightIndex = 4 number (0-7)

  • peekOnHover = true boolean

phases array used for indexes:

const phases = ["πŸŒ‘", "πŸŒ’", "πŸŒ“", "πŸŒ”", "πŸŒ•", "πŸŒ–", "πŸŒ—", "🌘"];

Any other props will be given directly to the <button> element.

License

MIT

About

πŸŒ•πŸŒ‘ Toggle and animate based on moon phases emoji

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors