Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 723 Bytes

Toggle.md

File metadata and controls

38 lines (27 loc) · 723 Bytes

Toggle

The Toggle component is used to toggle a boolean. True/false.

import { Toggle } from 'react-powerplug'
<Toggle initial={false}>
  {({ on, toggle }) => <Checkbox onClick={toggle} checked={on} />}
</Toggle>

Toggle Props

initial = false (optional)
Specifies the initial on state, must be an boolean. By default, the initial on state is false.

onChange (optional)
The onChange event of the Toggle is called whenever the on state changes.

Toggle Children Props

TL;DR: { on, toggle, set }

on
boolean
Your on state value

toggle
() => void
Toggle your on state value

set
(value: boolean) => void
Arbitrary set a value to on state