Skip to Content
⭐️ Leave a star →
ComponentsSlider

Slider

Currently only available in React.

Single-value or two-thumb range slider with pointer drag and full keyboard support. Horizontal or vertical, optionally inverted. The component renders track / fill / thumb as inner <span> elements with data-part attributes so you can style them via Tailwind arbitrary selectors (or any CSS).

Features

Single-value or two-thumb range mode via range prop.
Pointer drag with snap-to-step.
Full keyboard support: Arrows, PageUp / PageDown, Home / End.
Horizontal or vertical orientation, optionally inverted.
Range thumbs cannot pass each other.

Example

Volume40%
Price range$20 – $80
import { Slider } from '@wire-ui/react' <Slider defaultValue={40} min={0} max={100} step={1} aria-label="Volume" /> <Slider range defaultValue={[20, 80]} min={0} max={100} step={5} aria-label="Price range" />

Styling

Slider renders three inner parts: [data-part=track], [data-part=fill], and [data-part=thumb]. Target them with Tailwind arbitrary selectors or plain CSS. Each thumb additionally carries data-thumb-index="0" / "1" for range sliders.

<Slider className=" [&_[data-part=track]]:bg-[#e5e5e5] [&_[data-part=fill]]:bg-black [&_[data-part=thumb]]:size-4 [&_[data-part=thumb]]:bg-white [&_[data-part=thumb]]:border " />

Using data attributes

The root receives data-orientation ("horizontal" / "vertical") and data-disabled. Thumbs receive data-part="thumb" and data-disabled when the slider is disabled.

[data-orientation="horizontal"] [data-part="track"] { height: 4px; width: 100%; } [data-orientation="vertical"] [data-part="track"] { width: 4px; height: 100%; } [data-part="thumb"][data-disabled] { opacity: 0.5; cursor: not-allowed; }

Single-value props

PropTypeDefaultDescription
rangefalsefalseSingle thumb mode
valuenumberControlled value
defaultValuenumberminInitial value (uncontrolled)
onChange(value: number) => voidCalled when the value changes

Range props

PropTypeDefaultDescription
rangetruerequiredTwo-thumb range mode
value[number, number]Controlled [start, end]
defaultValue[number, number][min, max]Initial value (uncontrolled)
onChange(value: [number, number]) => voidCalled when either thumb moves

Shared props

PropTypeDefaultDescription
minnumber0Minimum value
maxnumber100Maximum value
stepnumber1Step increment
orientation'horizontal' | 'vertical''horizontal'Layout orientation
disabledbooleanfalseDisable the slider
invertedbooleanfalseReverse direction
aria-labelstringAccessible name

Data attributes

AttributeElementValues
data-orientationRoot"horizontal" / "vertical"
data-disabledRoot, ThumbPresent when disabled
data-partInner spans"track" / "fill" / "thumb"
data-thumb-indexThumb"0" (lower) / "1" (upper, range only)

Accessibility

  • Each thumb is a focusable <span> with role="slider" and aria-valuemin / aria-valuemax / aria-valuenow.
  • aria-orientation reflects the orientation prop.
  • Range sliders set role="group" on the root with the provided aria-label.
  • Always provide aria-label (or aria-labelledby) for non-range sliders.

Keyboard Interactions

KeyDescription
ArrowUp / ArrowRightIncrement by step (direction adjusts for orientation + inverted).
ArrowDown / ArrowLeftDecrement by step (direction adjusts for orientation + inverted).
PageUpIncrement by step * 10.
PageDownDecrement by step * 10.
HomeJump to min.
EndJump to max.
Last updated on

MIT License © 2026 wire-ui

Slider – Wire UI