https://github.com/kunukn/react-fuzzy-toggle
https://github.com/kunukn/react-fuzzy-toggle
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kunukn/react-fuzzy-toggle
- Owner: kunukn
- License: mit
- Created: 2017-12-30T10:04:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T23:23:28.000Z (over 7 years ago)
- Last Synced: 2024-04-25T09:01:07.897Z (about 1 year ago)
- Language: JavaScript
- Size: 198 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# react-fuzzy-toggle
Interruptible toggle with a state between 0 and 1.
You can reverse the toggle direction before it has finished the toggling.## npm
https://www.npmjs.com/package/react-fuzzy-toggle
## cdn
https://unpkg.com/react-fuzzy-toggle/
## demo
* npm install
* npm start```js
import { FuzzyToggle } from 'react-fuzzy-toggle';{/* optional callback when full happens */}}
onEmpty={({hasReversed}) => {/* optional callback */}}
onIncreasing={({range, hasReversed}) => {/* optional callback */}}
onDecreasing={({range, hasReversed}) => {/* optional callback */}}
render={({
onToggle,
range,
toggleState,
isFuzzy,
hasReversed,
}) => (
toggle
value between 0 and 1 included: {range.toFixed(1)}
full, empty, increasing or decreasing: {toggleState}
if range is between 0 and 1 not included: {isFuzzy}
)}
/>
```