# @trendmicro/react-toggle-switch

> Trend Micro Components: React Toggle Switch

Latest version **0.5.7** (published 2017-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @trendmicro/react-toggle-switch
pnpm add @trendmicro/react-toggle-switch
yarn add @trendmicro/react-toggle-switch
bun add @trendmicro/react-toggle-switch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.7 |
| Published | 2017-10-27 |
| First published | 2017-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Cheton Wu |
| Maintainers | cheton, trendmicro-frontend |
| Keywords | react, react-toggle-switch |

## Links

- npm: https://www.npmjs.com/package/@trendmicro/react-toggle-switch
- Repository: https://github.com/trendmicro-frontend/react-toggle-switch
- Issues: https://github.com/trendmicro-frontend/react-toggle-switch/issues
- npm.io page: https://npm.io/package/@trendmicro/react-toggle-switch

## Dependencies (3)

- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8
- [@trendmicro/react-anchor](https://npm.io/package/@trendmicro/react-anchor.md) ^0.5.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.5.7 (latest) — 2017-10-27
- 0.5.6 — 2017-10-06
- 0.5.5 — 2017-06-23
- 0.5.4 — 2017-04-20
- 0.5.3 — 2017-04-19
- 0.5.2 — 2017-03-02
- 0.5.1 — 2017-02-27
- 0.5.0 — 2017-01-19

## README

# react-toggle-switch [![build status](https://travis-ci.org/trendmicro-frontend/react-toggle-switch.svg?branch=master)](https://travis-ci.org/trendmicro-frontend/react-toggle-switch) [![Coverage Status](https://coveralls.io/repos/github/trendmicro-frontend/react-toggle-switch/badge.svg?branch=master)](https://coveralls.io/github/trendmicro-frontend/react-toggle-switch?branch=master)

[![NPM](https://nodei.co/npm/@trendmicro/react-toggle-switch.png?downloads=true&stars=true)](https://nodei.co/npm/@trendmicro/react-toggle-switch/)

React Toggle Switch

Demo: https://trendmicro-frontend.github.io/react-toggle-switch

## Installation

1. Install the latest version of [react](https://github.com/facebook/react) and [react-toggle-switch](https://github.com/trendmicro-frontend/react-toggle-switch):

  ```
  npm install --save react @trendmicro/react-toggle-switch
  ```

2. At this point you can import `@trendmicro/react-toggle-switch` and its styles in your application as follows:

  ```js
  import ToggleSwitch from '@trendmicro/react-toggle-switch';

  // Be sure to include styles at some point, probably during your bootstraping
  import '@trendmicro/react-toggle-switch/dist/react-toggle-switch.css';
  ```

## Usage

### Uncontrolled Component

```js
<ToggleSwitch
    checked
    ref={(node) => {
        this.toggleSwitch = node;
    }}
/>
```

You can get the value of the checked attribute:

```js
console.log(this.toggleSwitch.checked);
// => true
```

### Controlled Component

```js
<ToggleSwitch
    checked={this.state.checked}
    onChange={(event) => {
        this.setState({ checked: !this.state.checked });
    }}
/>
```

## API

### Properties

<table>
  <thead>
    <tr>
      <th align="left">Name</th>
      <th align="left">Type</th>
      <th align="left">Default</th>
      <th align="left">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>checked</td>
      <td>boolean</td>
      <td>false</td>
      <td></td>
    </tr>
    <tr>
      <td>disabled</td>
      <td>boolean</td>
      <td>false</td>
      <td></td>
    </tr>
    <tr>
      <td>onChange</td>
      <td>function</td>
      <td></td>
      <td>A callback fired when toggling checked state.</td>
    </tr>
    <tr>
      <td>size</td>
      <td>One of:<br>'large'<br>'lg'<br>'small'<br>'sm'</td>
      <td>'lg'</td>
      <td></td>
    </tr>
  </tbody>
</table>

## License

MIT

---
_Source: https://npm.io/package/@trendmicro/react-toggle-switch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
