@cloudflare/component-toggle
TypeScript icon, indicating that this package has built-in type declarations

11.0.2 • Public • Published

@cloudflare/component-toggle

Cloudflare Toggle Component

Installation

Installation with yarn is recommended

$ yarn add @cloudflare/component-toggle

Usage

import React from 'react';
import { Toggle } from '../../src/index';

class ToggleComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      toggleValue: false
    };
  }

  handleToggle(value) {
    this.setState({
      toggleValue: value
    });
  }

  render() {
    return (
      <div>
        <p>Example Toggle</p>
        <Toggle
          label="Example Toggle"
          name="example"
          value={this.state.toggleValue}
          onChange={this.handleToggle.bind(this)}
        />
        <p>Disabled</p>
        <Toggle
          disabled
          label="Disabled Toggle"
          name="example-disabled"
          value={this.state.toggleValue}
          onChange={this.handleToggle.bind(this)}
        />
        <p>
          {`If you specifically don't want to use a label then you must pass false`}
        </p>

        <p>Note: Designed to work with redux-form.</p>
      </div>
    );
  }
}

export default ToggleComponent;

/@cloudflare/component-toggle/

    Package Sidebar

    Install

    npm i @cloudflare/component-toggle

    Weekly Downloads

    7,219

    Version

    11.0.2

    License

    BSD-3-Clause

    Unpacked Size

    203 kB

    Total Files

    9

    Last publish

    Collaborators

    • rexscaria
    • dcruz_cf
    • xuranwang
    • jculvey
    • sejoker
    • vasturiano
    • pcostanzo
    • cf-radar
    • cf-ci-write
    • segments-write
    • thibmeu
    • xortive
    • gurjinder
    • cf-ci2
    • lvalenta
    • worenga
    • chiminator
    • third774
    • jasnell
    • terinjokes
    • celso
    • jsteinberger
    • geelen
    • gregbrimble
    • asapzacy
    • marksteyn
    • g4brym
    • wrangler-publisher
    • snigdha34
    • sgoodhew_cf
    • cf-media-manager
    • dash_service_account
    • lbarthonet
    • jacobbednarz
    • lerwincf
    • simonabadoiu
    • cms1919