cli-slider

1.0.1 • Public • Published

Slider.js

Slider.js is a cli slider based on html's input:range tag. A gif example

Controls

Using the left and right arrow keys you can move the slider. Shift moves it by 100 and control by 10. Enter will confirm the selected value and emit the value event.

Usage:

npm i cli-slider

Its easy to use:

const Slider = require('cli-slider')
const slider = new Slider(0, 100)
const slider = new Slider(currentValue, maxValue, size, symbol)

size: by default 50 is the amount of pipes | to represent the slider. symbol: is an optional paramenter that appears after the value. Say if you want °, °C or cm as a measurement.

Events:

changed: Emitted at every change of the slider. Jumping to 100 via the shift+arrow will only emit once. value: Emitted on enter keypress and stops the rendering of slider by also deleting it and replacing the cursor at the start of that line.

Readme

Keywords

Package Sidebar

Install

npm i cli-slider

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.28 kB

Total Files

3

Last publish

Collaborators

  • metruzanca