1.3.2 • Published 5 years ago

toggs v1.3.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

toggs npm version

a React toggle that doesnt suck

material ios

Inspired by this tweet

:exclamation: CAUTION

this was hacked together using an self updated version of create-react-library; this is my first time creating a library :sweat_smile:

  • create-react-library and all deps were updated
  • create-react-app/example folder was removed
  • react-cosmos is used instead for dev/demo purposes

:sunglasses: INSTALL

$ yarn add toggs

:fire: USAGE

import React, { useState } from 'react'
import Toggs from 'toggs'

const Example = () => {
  const [ checked, setChecked ] = useState(false)
  return (
    <Toggs
      check={checked}
      onClick={() => setChecked(!checked)}
    />
  )
}

Examples

:eyes: PROPS

PropTypeDefaultDescription
checkedboolfalseSelf-explanatory
onChangefuncnoOpFunction to invoke when User clicks on component. Inverted checked value will be passed as arg to the function.
themestringmaterialChoose between material or ios
trueColorstring#14D790Hex or rgb(a) value for when toggle is true.
falseColorstring#000000Hex or rgb(a) value for when toggle is false.
widthnumber34Width in px. Will automatically scale.

:pencil2: DEVELOP

  • clone
  • run yarn install
  • run yarn run cosmos
  • do stuff

:pray: MADE WITH

License

MIT

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.1.0

5 years ago

1.0.9

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