https://github.com/derhuerst/range-prompt
A prompt to select a value in a range.
https://github.com/derhuerst/range-prompt
cli prompt
Last synced: about 1 year ago
JSON representation
A prompt to select a value in a range.
- Host: GitHub
- URL: https://github.com/derhuerst/range-prompt
- Owner: derhuerst
- License: isc
- Created: 2016-11-21T10:11:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-07-05T10:12:56.000Z (about 4 years ago)
- Last Synced: 2025-03-28T16:21:19.363Z (over 1 year ago)
- Topics: cli, prompt
- Language: JavaScript
- Homepage: https://github.com/derhuerst/range-prompt
- Size: 12.7 KB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# range-prompt
**A prompt to select a value in a range.**
[](https://asciinema.org/a/93623)
[](https://www.npmjs.com/package/range-prompt)
[](https://david-dm.org/derhuerst/range-prompt#info=dependencies)
[](https://david-dm.org/derhuerst/range-prompt#info=devDependencies)

[](https://gitter.im/derhuerst)
*range-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
```
npm install range-prompt
```
## Usage
```js
const rangePrompt = require('range-prompt')
rangePrompt('How much ice cream would you like?', {
min: 0, max: 10, value: 2, step: .1, unit: 'kg'
})
.on('data', (item) => console.log('Changed to', item, 'kg'))
.on('abort', (item) => console.log('You aborted, having chosen', item, 'kg'))
.on('submit', (item) => console.log('You chose', item, 'kg'))
```
## Related
- [`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)
- [`select-prompt`](https://github.com/derhuerst/select-prompt)
- [`text-prompt`](https://github.com/derhuerst/text-prompt)
- [`tree-select-prompt`](https://github.com/derhuerst/tree-select-prompt)
- [`cli-autocomplete`](https://github.com/derhuerst/cli-autocomplete)
- [`switch-prompt`](https://github.com/derhuerst/switch-prompt)
## 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/range-prompt/issues).