# prompt-radio

> Radio prompt. Can be used as a standalone prompt, or as a plugin for [Enquirer].

Latest version **1.2.1** (published 2017-07-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2017-07-08 |
| First published | 2016-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | answer, answers, ask, checkbox, choice, cli, command, enquirer, enquirer-prompt, enquirerprompt, input, inquire, inquirer, interact, list, menu, password, plugin, prompt, prompts, question, radio, readline, stdin, stdout, terminal, tty, ui |

## Links

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

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^2.6.8
- [prompt-checkbox](https://npm.io/package/prompt-checkbox.md) ^2.2.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2017-07-08
- 1.2.0 — 2017-07-08
- 1.1.2 — 2017-06-05
- 1.1.1 — 2017-06-05
- 1.1.0 — 2017-06-02
- 1.0.0 — 2017-05-23
- 0.3.1 — 2016-12-07
- 0.3.0 — 2016-09-21

## README

# prompt-radio [![NPM version](https://img.shields.io/npm/v/prompt-radio.svg?style=flat)](https://www.npmjs.com/package/prompt-radio) [![NPM monthly downloads](https://img.shields.io/npm/dm/prompt-radio.svg?style=flat)](https://npmjs.org/package/prompt-radio) [![NPM total downloads](https://img.shields.io/npm/dt/prompt-radio.svg?style=flat)](https://npmjs.org/package/prompt-radio) [![Linux Build Status](https://img.shields.io/travis/enquirer/prompt-radio.svg?style=flat&label=Travis)](https://travis-ci.org/enquirer/prompt-radio)

> Radio prompt. Can be used as a standalone prompt, or as a plugin for [Enquirer](http://enquirer.io).

![prompt-radio example](https://raw.githubusercontent.com/enquirer/prompt-radio/master/docs/example.gif)

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save prompt-radio
```

## Usage

```js
var Radio = require('prompt-radio');
var prompt = new Radio({
  name: 'colors',
  message: 'Favorite flavor?',
  choices: [
    'chocolate',
    'strawberry',
    'vanilla'
  ]
});

// async
prompt.ask(function(answer) {
  console.log(answer);
  // chocolate
});

// promise
prompt.run()
  .then(function(answer) {
    console.log(answer);
    // chocolate
  });
```

## Enquirer plugin

Register as a plugin with [enquirer](http://enquirer.io):

```js
var Enquirer = require('enquirer');
var enquirer = new Enquirer();

enquirer.register('radio', require('prompt-radio'));
```

### Enquirer examples

[Enquirer](http://enquirer.io) supports both the declarative inquirer-style question format and a functional format using the `.question` method:

**Declarative format**

Questions can be defined as an array of objects, or a single question object:

```js
var questions = [
  {
    name: 'color',
    message: 'What is your favorite color?',
    type: 'radio',
    default: 'blue',
    choices: ['red', 'yellow', 'blue']
  }
];

enquirer.ask(questions)
  .then(function(answers) {
    console.log(answers)
  });
```

**Expressive format**

Functional style questions.

```js
enquirer.question('color', 'Favorite color?', {
  type: 'radio',
  choices: ['red', 'yellow', 'blue']
});

enquirer.question('flavor', 'Favorite flavor?', {
  type: 'radio',
  default: 'chocolate',
  choices: ['chocolate'] //<= no need for other choices ;)
});

enquirer.ask(['color', 'flavor'])
  .then(function(answers) {
    console.log(answers)
  });
```

## Options

### options.pointer

Customize the pointer to use.

TODO

### options.checkbox

**Type**: `Object`

**Default**: (TODO)

Customize the checkbox symbols to use.

## About

### Related projects

* [prompt-base](https://www.npmjs.com/package/prompt-base): Base prompt module used for creating custom prompts. | [homepage](https://github.com/enquirer/prompt-base "Base prompt module used for creating custom prompts.")
* [prompt-checkbox](https://www.npmjs.com/package/prompt-checkbox): Multiple-choice/checkbox prompt. Can be used standalone or with a prompt system like [Enquirer](http://enquirer.io). | [homepage](https://github.com/enquirer/prompt-checkbox "Multiple-choice/checkbox prompt. Can be used standalone or with a prompt system like [Enquirer].")
* [prompt-confirm](https://www.npmjs.com/package/prompt-confirm): Confirm (yes/no) prompt. Can be used standalone or with a prompt system like [Enquirer](http://enquirer.io). | [homepage](https://github.com/enquirer/prompt-confirm "Confirm (yes/no) prompt. Can be used standalone or with a prompt system like [Enquirer].")
* [prompt-question](https://www.npmjs.com/package/prompt-question): Question object, used by Enquirer and prompt plugins. | [homepage](https://github.com/enquirer/prompt-question "Question object, used by Enquirer and prompt plugins.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 08, 2017._

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