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

Code
import { Slider } from "zudoku/ui/Slider";
Basic Usage

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

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

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

Code
<Slider defaultValue={[50]} max={100} step={1} disabled />
Custom Step Size

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

Code
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