# tty-select

> Console/terminal async selector

Latest version **0.9.2** (published 2022-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install tty-select
pnpm add tty-select
yarn add tty-select
bun add tty-select
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.2 |
| Published | 2022-10-27 |
| First published | 2022-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 40.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Greg Varsanyi |
| Maintainers | gvarsanyi |

## Links

- npm: https://www.npmjs.com/package/tty-select
- Repository: https://github.com/gvarsanyi/tty-select
- Homepage: https://github.com/gvarsanyi/tty-select#readme
- Issues: https://github.com/gvarsanyi/tty-select/issues
- npm.io page: https://npm.io/package/tty-select

## Recent versions

- 0.9.2 (latest) — 2022-10-27
- 0.9.1 — 2022-10-27
- 0.9.0 — 2022-10-26

## README

# tty-select
Creates async an in-line selector from a simple string on the terminal.

## Install
```sh
npm install tty-select
```

## Use
```javascript
import { select } from 'tty-select';

select('Need you to say {*^yes} or {^no}').then((choice) => console.log('You said:', choice.text))
```
Renders on console as: "Need you to say <ins>**y**es</ins> or <ins>**n**o</ins>" (with "yes" highlighted)

## Symbols
- `{` and `}` mark the boundaries of a selectable text
- Within the selectable text: a starting `*` marks the pre-selected option
- Within the selectable text: `^` marks the following character as shortcut (case-insensitive)
All these symbols can be escaped by prefixing them with a `backslash`.

## Selection
- `right` or `tab`: moves selection to the right
- `end`: moves selection to the last selectable item
- `left` or `shift`+`tab`: moves selection to the left
- `home`: moves selection to the first selectable item
- `enter`: returns highlighted selection
- any shortcut: selects item, and returns it

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