HextaUI

Slider: Right to left

Inside a right-to-left parent the fill starts from the right and the arrow keys follow it. Pass locale for the reader's digits.

مستوى الصوت
٦٥
النطاق
٢٠ – ٧٠
import { Slider, SliderLabel, SliderValue } from "@/components/ui/slider"

export function SliderRtl() {
  return (
    <div dir="rtl" className="flex w-full max-w-xs flex-col gap-8">
      <Slider defaultValue={65} locale="ar-EG">
        <SliderLabel>مستوى الصوت</SliderLabel>
        <SliderValue />
      </Slider>
      <Slider defaultValue={[20, 70]} locale="ar-EG" draggableRange>
        <SliderLabel>النطاق</SliderLabel>
        <SliderValue />
      </Slider>
    </div>
  )
}

This adds the example as components/examples/slider/rtl.tsx, together with the Slider component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/slider-rtl.json

To add only the component, follow the Slider installation.

Props in this example

The Slider props this example sets, from the API reference.

PropTypeDefault
defaultValue
number | number[]–
draggableRangeIn a range, dragging between the thumbs moves them together, keeping the gap.
booleanfalse
locale
Intl.LocalesArgument"en-US"

Every prop is in the Slider API reference.

See them all, with keyboard support and accessibility notes, on the Slider page.