1.2.1 • Published 4 years ago

react-darkmode-toggler v1.2.1

Weekly downloads
23
License
MIT
Repository
github
Last release
4 years ago

react-darkmode-toggler

image

Made with create-react-library

NPM JavaScript Style Guide

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'
    />
  )
}

pushpin 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

MIT ©

1.2.0

4 years ago

1.1.8

4 years ago

1.2.1

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago