Sha256: febf1ef0a1a351b7c29225512ce4efe3245ffeb9c61920ed67b9744eb684c412

Contents?: true

Size: 955 Bytes

Versions: 9

Compression:

Stored size: 955 Bytes

Contents

// @flow

import React from "react"
import { Toggle } from "../../"

class Example extends React.Component {
  state = {
    toggle1: false,
    toggle2: true,
  }

  handleChange = event => {
    this.setState({
      [event.target.name]: event.target.checked
    })
  }

  render() {
    return (
      <>
        <Toggle
            checked={this.state.toggle1}
            name="toggle1"
            onChange={this.handleChange}
            onCheck={event => console.log(`${event.target.name} checked!`)}
            onUncheck={event => console.log(`${event.target.name} unchecked!`)}
        />

        <br />

        <Toggle
            checked={this.state.toggle2}
            name="toggle2"
            onChange={this.handleChange}
            onCheck={event => console.log(`${event.target.name} checked!`)}
            onUncheck={event => console.log(`${event.target.name} unchecked!`)}
        />
      </>
    )
  }
}

export default Example

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
playbook_ui-3.1.0 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-3.0.1 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-3.0.0 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.9 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.8 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.7 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.6 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.5 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx
playbook_ui-2.9.4 app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx