react-toggle-aware
A tiny higher order component to track toggle state.
Example
;; @ { // props will include the toggle handler let isToggled className ...props = thisprops; if isToggled className += ' on'; return <div ...props className=className> </div> };
API
As a decorator
@Component /* your code */
As a function
Component /* your code */ optionsTest;
Options
onDelay
defaults to 0
Time in ms
to wait before setting the active
status to true
.
offDelay
defaults to 0
Time in ms
to wait before setting the active
status to false
.
handler
defaults to 'onToggle'
Property name to expose the handler
as.
key
defaults to 'isToggled'
Property name to expose the active
status as.