Skip to content

Slider

Select a value or range by dragging a thumb.

Installation

bun add @xerobi/ui
import { Slider } from "@xerobi/ui/slider"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Default

import { Slider } from "@xerobi/ui/slider"

export function SliderDefault() {
  return <Slider className="w-64" defaultValue={[40]} max={100} aria-label="Volume" />
}

Range

import { Slider } from "@xerobi/ui/slider"

export function SliderRange() {
  return <Slider className="w-64" defaultValue={[25, 75]} max={100} aria-label="Price range" />
}

API reference

Slider

Also accepts every prop of Base UI Slider.

No props of its own.

Styling hooks: [data-slot="slider"], [data-slot="slider-track"], [data-slot="slider-range"], [data-slot="slider-thumb"].

Search documentation

Search pages, components and blocks.