# switch-prompt

> A CLI prompt with an iOS-style on/off switch.

Latest version **0.1.0** (published 2016-12-06) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install switch-prompt
pnpm add switch-prompt
yarn add switch-prompt
bun add switch-prompt
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-12-06 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | switch, toggle, ui, interactive, prompt, command line, cli, terminal, readline |

## Links

- npm: https://www.npmjs.com/package/switch-prompt
- Repository: https://github.com/derhuerst/switch-prompt
- Issues: https://github.com/derhuerst/switch-prompt/issues
- npm.io page: https://npm.io/package/switch-prompt

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [cli-styles](https://npm.io/package/cli-styles.md) ^0.5
- [ansi-escapes](https://npm.io/package/ansi-escapes.md) ^1.4
- [prompt-skeleton](https://npm.io/package/prompt-skeleton.md) ^0.3.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-12-06

## README

# switch-prompt

**A CLI prompt with an [iOS-style on/off switch](https://developer.apple.com/ios/human-interface-guidelines/ui-controls/switches/).**

[![asciicast](https://asciinema.org/a/95216.png)](https://asciinema.org/a/95216)

[![npm version](https://img.shields.io/npm/v/switch-prompt.svg)](https://www.npmjs.com/package/switch-prompt)
[![dependency status](https://img.shields.io/david/derhuerst/switch-prompt.svg)](https://david-dm.org/derhuerst/switch-prompt)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/switch-prompt.svg)

*switch-prompt* uses [*cli-styles*](https://github.com/derhuerst/cli-styles) and [*prompt-skeleton*](https://github.com/derhuerst/prompt-skeleton) to have a look & feel consistent with [other prompts](https://github.com/derhuerst/prompt-skeleton#prompts-using-prompt-skeleton).


## Installing

```shell
npm install switch-prompt
```


## Usage

```
switchPrompt(question, [activeText], [inactiveText], [defaultValue])
```

```javascript
const switchPrompt = require('switch-prompt')
switchPrompt('Send anonymous usage data?', 'yes', 'no', true)
.on('data', (e) => console.log('Interim value', e.value))
.on('submit', (v) => console.log('Submitted with', v))
.on('abort', (v) => console.log('Aborted with', v))
```


## Related

- [`text-prompt`](https://github.com/derhuerst/text-prompt)
- [`date-prompt`](https://github.com/derhuerst/date-prompt)
- [`mail-prompt`](https://github.com/derhuerst/mail-prompt)
- [`multiselect-prompt`](https://github.com/derhuerst/multiselect-prompt)
- [`number-prompt`](https://github.com/derhuerst/number-prompt)
- [`range-prompt`](https://github.com/derhuerst/range-prompt)
- [`select-prompt`](https://github.com/derhuerst/select-prompt)
- [`tree-select-prompt`](https://github.com/derhuerst/tree-select-prompt)
- [`cli-autocomplete`](https://github.com/derhuerst/cli-autocomplete)


## Contributing

If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/switch-prompt/issues).

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