next-day-theme-toggle
v0.0.6
Published
<h1 style="text-align: center; color: #48bb37">React Day Theme Toggle</h1>
Downloads
2
Readme
$ npm install -s next-day-theme-toggle
Using yarn:
$ yarn install -s next-day-theme-toggle
Use the component DayNightToggle to display a nice toggle in your header or somewhere else. We will be allowing you to choose different style versions of the toggle in next versions.
Beware to wrap the component in a div, the toggle will take 100% of its parent width.
Also give it those two props : {theme, setTheme}, to make sure that the toggle can change your theme context
import React, {useContext} from 'react';
import DayNightToggle from "react-day-theme-toggle/";
import ThemeContext from "./contexts/ThemeContext"
const Header = () => {
const {theme, setTheme} = useContext(ThemeContext)
return (
<div>
<DayNightToggle style={"classic"} theme={theme} setTheme={setTheme}/>
</div>
);
};
export default Header;