Components

Slider

Usage

const seatEstimate = await io.input.slider('How many seats are needed')
console.log(seatEstimate) // 64

Parameters

labelrequired
string

The label to render above the input.

options { ... }
defaultValue
number

Default value rendered in input. Default 0.

step
number

Default value rendered in input. Default 1.

min
number | undefined

Default value rendered in input. Default undefined.

max
number | undefined

Default value rendered in input. Default undefined.

markLabels
boolean

Render increment marks along slider. Default false.

disabled
boolean

Disables user input. Default false.

snapToMarks
boolean

Dragging slider snaps to marked increments. Default false.

help
string

The small help text to render below the input. Default undefined.

marks
Array<{ at: number, label: string }> | boolean

Display increment ticks at specific points along the slider. Without an array the marks will be inherited by the step property. Default false.

customValidator
(input: unknown) => Promise<string | true>

An asynchronous function that takes unknown input and outputs either true or an error message string to show the user.