Slider
FormsAdjusts one or more numeric values by moving labeled thumbs along a track.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/slider.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes label, typography. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/slider.json https://luv-jeri.github.io/cojeev-ui/r/label.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing slider
Set min, max, and step for the value domain and use value or defaultValue arrays for the thumbs.
Use SliderOutput or nearby text to show the current value and its unit.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
SliderProps
| Prop | Type | Required |
|---|---|---|
variant | "default" | "pink" | null | undefined | No |
thumbLabel | string|((index:number)=>string) | No |
appearance | SliderAppearance | No |
SliderWrapperProps
Accepts the native or primitive props declared by its exported TypeScript type.
SliderRowProps
Accepts the native or primitive props declared by its exported TypeScript type.
SliderOutputProps
Accepts the native or primitive props declared by its exported TypeScript type.
Accessibility
Provide thumbLabel for every thumb, using the index callback when their meanings differ.
Keep the numeric value understandable without relying on the thumb position alone.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.