1.2.1 • Published 5 years ago
react-darkmode-toggler v1.2.1
react-darkmode-toggler
Made with create-react-library
Demo
Install
npm i react-darkmode-toggler
or
yarn add react-darkmode-toggler
Usage
import React, { useState } from 'react'
import { DarkModeToggler } from 'react-darkmode-toggler'
const App = () => {
const [isDark, setIsDark] = useState<'light' | 'dark'>('light')
// button toggler
const darkModeHandler = () => {
setIsDark(isDark === 'light' ? 'dark' : 'light')
}
return (
<DarkModeToggler
size='small'
isDark={isDark}
onClick={darkModeHandler}
border='#000'
/>
)
}
Props
| Props | Types | Default | Required |
| ------- | ------------------- | ------- | -------- |
| isDark | `light` or `dark` | 'light' | no |
| onClick | func | null | yes |
| size | `middle` or `small` | no | no |
| border | hex color | #000 | no |
License
1.2.0
5 years ago
1.1.8
5 years ago
1.2.1
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago