Duolith docs

Slider

Picks a number from a range, with its label and current value above it and the ends below.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe label and accessible name.
valuenumberbindable(0)The number. Bind it with bind:value={name}.
minnumber0The smallest number.
maxnumber100The largest number.
stepnumber1The distance between numbers.
unitstringWritten after each number, such as %.
disabledbooleanfalseCannot be moved or focused.

States

StateLooks like
draggingThe thumb follows the pointer; the value updates live.
focusedThe focus outline.
disabledThe whole part at 50% opacity.

Accessibility

roleslider
nameThe label prop.
focusTab reaches it; Shift+Tab leaves it. A disabled one is skipped.
keyboardArrow keys move one step; Home and End jump to the ends.

Theme tokens

color.primary color.ink color.muted space.1 text.label text.body text.caption

Example

<Slider label="Volume" unit="%" bind:value={volume} />