Build · New

Slider

Pick a value or a range by dragging or with the keyboard, when the feel matters more than the exact number: volume, zoom, a price range.

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

Installation

SoonInstalling from the registry opens at launch. Until then the command below is what it will be.
npx shadcn@latest add @ritla/slider

Dependencies it brings: @base-ui/react, @phosphor-icons/react

Usage

import { Slider } from "@/components/ui/slider";
<Slider aria-label="Volume" defaultValue={40} />
<Slider aria-label="Price" min={0} max={1000} step={50} defaultValue={[200, 800]} />

Examples

Sizes

xs to xl: a 16, 24, 40, 56 or 96px track.

Circle handle and stops

handleStyle="circle", and showStops puts a dot at every step when only certain values are allowed.

Centered

Fills from the middle of the range toward the value, for values that go below or above zero.

Range

Two values [from, to] with two handles, each named for screen readers.

Vertical

Fills from the bottom in both directions; Up and Down move it.

Disabled

API reference

Slider

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl""xs"Figma's Size: XSmall to XLarge.
handleStyle"line" | "circle""line"Figma's Handle style.
showStopsbooleanfalseFigma's Show stops: a dot at every step. Without it, only the end of an empty track gets a dot.
centeredbooleanfalseFigma's Centered slider: fills from the middle of the range.
orientation"horizontal" | "vertical""horizontal"Figma's Vertical slider.
value / defaultValuenumber | [number, number]A number, or [from, to] for Figma's Range slider.
min / max / stepnumber0 / 100 / 1The value's bounds and step.
largeStepnumber10The Page Up / Page Down step.
onValueChange / onValueCommitted(value) => voidWhile dragging, and on release.
showValuebooleantrueThe value bubble while dragging or when focused from the keyboard.
formatIntl.NumberFormatOptionsHow the value reads in the bubble and to screen readers (currency, percent).
numerals"latn" | "arab"Numeral system; defaults to KanzProvider's.
disabledbooleanfalseFigma's State = Disabled.
aria-labelstringThe slider's name ("Volume").

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
ArrowRightArrowUpIncreases by one step. In Arabic, ArrowLeft increases.
ArrowLeftArrowDownDecreases by one step. In Arabic, ArrowRight decreases.
PageUpPageDownChanges by largeStep.
HomeEndJumps to the minimum or the maximum.

ARIA

  • Each handle is role="slider" with aria-valuemin, aria-valuemax and aria-valuenow, and value text in the same format and numerals.
  • In a range, the handles are named "…, from" and "…, to".
  • For precise amounts like a transfer amount, use a field, or pair one with the slider.

Arabic and RTL notes

Mirrors

  • Horizontal sliders fill from the right: the minimum sits on the right, and ArrowLeft increases.
  • Range and centered sliders mirror the same way.

Does not mirror

  • Vertical sliders fill from the bottom in both languages.
  • The circle handle's icon is symmetric and doesn't flip.
Numerals
The value bubble and the screen reader text use the chosen numerals (0-9 or ٠-٩) and the language's formatting.
Arabic typography
label-14 Medium in the bubble.
Mixed-direction text
The value is isolated in the bubble, so a currency sign or minus stays in place.

All components ›