Zudoku
Form

Slider

A slider component built on Radix UI primitives for numeric input with a range.

Import

tsxCode
import { Slider } from "zudoku/ui/Slider";

Basic Usage

tsxCode
<Slider defaultValue={[50]} max={100} step={1} />

Range Slider

tsxCode
<Slider defaultValue={[25, 75]} max={100} step={1} />

With Label

tsxCode
<div className="space-y-2"> <Label>Volume</Label> <Slider defaultValue={[33]} max={100} step={1} /> </div>

Disabled State

tsxCode
<Slider defaultValue={[50]} max={100} step={1} disabled />

Custom Step Size

tsxCode
<div className="space-y-2"> <Label>Price Range ($)</Label> <Slider defaultValue={[100]} max={1000} min={0} step={50} /> </div>

With Value Display

75%
tsxCode
const SliderWithValue = () => { const [value, setValue] = useState([75]); return ( <div className="space-y-2"> <div className="flex justify-between"> <Label>Brightness</Label> <span className="text-sm text-muted-foreground">{value[0]}%</span> </div> <Slider value={value} max={100} step={1} onValueChange={setValue} /> </div> ); };

Features

  • Accessibility: Full keyboard navigation and screen reader support
  • Multiple Thumbs: Support for range sliders with multiple values
  • Customizable: Easy to style with className prop
  • Touch Support: Optimized for touch devices
Last modified on