1.1.1 • Published 6 years ago
react-moon-toggle v1.1.1
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-toggleProps
darkboolean (required)setDark=(newDark: boolean) => null?functioninterval=50numberdarkIndex=0number (0-7)lightIndex=4number (0-7)peekOnHover=trueboolean
phases array used for indexes:
const phases = ["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"];phases array used for indexes:
const phases = ["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"];Any other props will be given directly to the <button> element.
License
MIT