# @oscbco/text-toggle

> Text toggle

Latest version **0.0.5** (published 2020-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @oscbco/text-toggle
pnpm add @oscbco/text-toggle
yarn add @oscbco/text-toggle
bun add @oscbco/text-toggle
```

## 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.0.5 |
| Published | 2020-09-11 |
| First published | 2020-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oscar Barrera |
| Maintainers | oscbco |

## Links

- npm: https://www.npmjs.com/package/@oscbco/text-toggle
- Homepage: https://oscbco.github.io
- npm.io page: https://npm.io/package/@oscbco/text-toggle

## Recent versions

- 0.0.5 (latest) — 2020-09-11
- 0.0.4 — 2020-06-17

## README

# @oscbco/text-toggle

A react toggle

![Demo](https://oscbco.github.io/images/text-toggle-demo.gif)

## Props
- `style`: This is an object containing the styles to be applied to the control

- `leftItem`: This is represents the item on the left
  - `value`: This is an id, it will be passed to the onChange callback
  - `label`: JSX element to be rendered on this item (Can also include styling of its own or be a simple string)
  - `style`: This is an object containing the styles to be applied to this item

- `rightItem`: This prop is the same as the left one.

- `onChange`: This is an callback that will be called when the control changes its value

- `defaultItem`: This is string containing the value of the item selected by default

## Example

```JS
<TextToggle defaultItem='dark'
  leftItem={{
    value: 'dark',
    label: 'DARK'
  }}
  rightItem={{
    value: 'light',
    label: 'LIGHT'
  }}
  onChange={this.onChange}
/>
```

To run the examples:

      $ git clone https://github.com/oscbco/text-toggle.git
      $ cd select
      $ npm install
      $ npm start

  Visit [http://localhost:9002](http://localhost:9002) to see and edit the examples. The development server is set up to be available from everywhere, even your mobile phone in your LAN.

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