Sha256: 353514dd161a4ba353078416c31095efa53f8f48b223909f4eaeef9cf1311441

Contents?: true

Size: 841 Bytes

Versions: 83

Compression:

Stored size: 841 Bytes

Contents

// @flow

import React, { useState } from 'react'
import { Toggle } from '../../'

const Example = () => {
  const [toggle1, setToggle1] = useState(false)
  const [toggle2, setToggle2] = useState(false)

  return (
    <>
      <Toggle
          checked={toggle1}
          name="toggle1"
          onChange={(event) => setToggle1(event.target.value)}
          onCheck={(event) => alert(`${event.target.name} checked!`)}
          onUncheck={(event) => alert(`${event.target.name} unchecked!`)}
      />

      <br />

      <Toggle
          checked={toggle2}
          name="toggle2"
          onChange={(event) => setToggle2(event.target.value)}
          onCheck={(event) => alert(`${event.target.name} checked!`)}
          onUncheck={(event) => alert(`${event.target.name} unchecked!`)}
      />
    </>
  )
}

export default Example

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
playbook_ui-3.4.0 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-3.3.0 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-3.2.0 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx