This package has been deprecated

Author message:

This package has been deprecated. Please find this package under its new name @cloudflare/component-toggle.

cf-component-toggle

6.0.0 • Public • Published

cf-component-toggle

Cloudflare Toggle Component

Installation

Installation with yarn is recommended

 
$ yarn add cf-component-toggle
 

Usage

import React from 'react';
import Toggle from 'cf-component-toggle';
 
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;
 

Readme

Keywords

none

Package Sidebar

Install

npm i cf-component-toggle

Weekly Downloads

5

Version

6.0.0

License

BSD-3-Clause

Unpacked Size

25.5 kB

Total Files

9

Last publish

Collaborators

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