Skip to contentKino
Skip to Content

Slider

A slider with one thumb or a range of two. The thumb glides to where you press, and its number rises above it while you hover, drag or use the arrow keys.

npx shadcn add https://kinoui.com/r/slider.json
Share on

Examples

Archive closed issues after
14 days

Closed issues leave the board after this many days. You can still search them.

Default

Put a SliderLabel and a SliderValue inside, and they sit in a row above the track. Press anywhere on the track and the thumb glides there.

Cycle capacity
40 points

Steps

Set step and the value moves in those steps, by pointer and by arrow keys. Page Up and Page Down move by largeStep.

Filter issues

Customer requests · all cycles
Estimate
2–8 points
Contract value
$12,500–$48,000
82 issues match

Range

Give an array as the value for a thumb at each end. format sets how the number above a thumb and the value read out are written.

100%

No visible label

Leave out the children and name it with aria-label. The page can hold the value, as the zoom buttons here do.

Monthly AI budget
$9,000

What Kino may spend on AI each month.

Your plan covers up to $8,000 a month.

Invalid

In an invalid Field, the fill and the thumb turn the destructive colour and the error takes the description’s place.

Seats

Set by your admin. Ask them to add more.
Seats on the Ledger plan
12 of 50

Disabled

A disabled slider fades and shows no number. Say why beside it, so nobody wonders.

Installation

npx shadcn@latest add https://kinoui.com/r/slider.json
Files
lib/reduce-motion.tslib/track.tslib/number-format.tslib/resize.tscomponents/kino/slider.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Slider

PropTypeDefaultDescription
valuenumbernumber[]NoneThe value, when you hold the state. An array draws a thumb for each entry.
defaultValuenumbernumber[]NoneThe value it starts at, when it holds its own state.
onValueChange(value, details) => voidNoneCalled on every change, while a thumb is dragged too.
onValueCommitted(value, details) => voidNoneCalled once a drag ends or a key moves it.
minnumber0The lowest value.
maxnumber100The highest value.
stepnumber1How far one arrow key, or one notch of a drag, moves it.
largeStepnumber10How far Page Up, Page Down and Shift with an arrow move it.
formatIntl.NumberFormatOptionsNoneHow the number above a thumb, SliderValue and the value read out are written.
variant'default''channel''default'A channel slider draws its track from --slider-track, a CSS background, and fills its thumb with --slider-thumb, with no fill: the Color picker’s channels use it.
aria-labelstringNoneNames a slider that has no SliderLabel.
getAriaLabel(index) => stringNoneNames each thumb of a range, such as "Lowest estimate".
getAriaValueText(formattedValue, value, index) => stringNoneWhat a screen reader reads for a thumb’s value, such as "14 days".

Data attributes

AttributeOnDescription
data-draggingSliderPresent while a thumb is dragged.
data-disabledSliderPresent while it is disabled.
data-invalidSliderPresent while its Field is invalid.

CSS variables

VariableSet it onDefaultDescription
--slider-value-riseSlider, or <body>6pxHow far a thumb's number rises out of it.

Accessibility

  • Each thumb is a native range input: arrow keys move it by step, Page Up and Page Down by largeStep, and Home and End to the ends.
  • Name it with SliderLabel, or with aria-label when there is no visible label. Name each thumb of a range with getAriaLabel.
  • The number above a thumb is for sighted users and is hidden from screen readers, which read the thumb’s own value instead.
  • In forced colours the fill takes the system highlight, and the focused thumb gets a system outline.
  • When the system asks for less motion, the thumb and the fill jump to the value, and the number fades in without rising.