All specs
Interactive · slider

Slider

Interactive numeric range input with ←/→ adjustment.

Anatomy

^ Volume  ━━━━━━━━━━╸──────────  50

←→ adjust · ctrl+b/f big jump · ↵ confirm · esc cancel

After submit:

^ Volume: 50

Usage

const volume = await slider({
  label: 'Volume',
  min: 0,
  max: 100,
  step: 5,
  defaultValue: 50,
})

Options

KeyTypeDefaultDescription
labelstringSlider label
minnumber?0Minimum value
maxnumber?100Maximum value
stepnumber?1Increment per press
defaultValuenumber?minInitial value
widthnumber?20Track width in chars
showValueboolean?trueShow numeric readout

Keyboard

KeyAction
Decrease by step
Increase by step
Ctrl+BDecrease by step × 10
Ctrl+FIncrease by step × 10
Confirm
escCancel → null

Tokens

colors.accent, symbols.progress (filled, empty, head)

Out of scope

Dual-range (min/max) slider

Vertical slider

Logarithmic scale