Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Primitives
Slider
Pick a value, or a range, by dragging.
import { Slider } from "@/registry/vcare/ui/slider"
export default function SliderDemo() {
return (
<div className="mx-auto grid w-full max-w-sm gap-6">
<Slider defaultValue={[40]} max={100} />
<Slider defaultValue={[20, 70]} max={100} />
</div>
)
}Installation
npx shadcn@latest add @vcare/sliderOr install directly from the URL: https://ui.vcarehms.com/r/slider.json
- Install the dependencies:
npm i radix-ui - Add the registry items it uses: utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/slider.tsx
import type { ComponentProps } from 'react';
import { Slider as SliderPrimitive } from 'radix-ui';
import { cn } from '@/registry/vcare/lib/utils';
/** Keyboard-accessible slider using the same control and theme tokens as other fields. Pass two values for a range. */
export function Slider({ className, 'aria-label': label, 'aria-describedby': description, ...props }: ComponentProps<typeof SliderPrimitive.Root>) {
const thumbs = props.value?.length ?? props.defaultValue?.length ?? 1;
return (
<SliderPrimitive.Root
data-slot="slider"
className={cn('group/slider relative flex min-h-8 w-full touch-none select-none items-center data-[disabled]:opacity-50', className)}
{...props}
>
<SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted">
<SliderPrimitive.Range className="absolute h-full rounded-full bg-primary" />
</SliderPrimitive.Track>
{Array.from({ length: thumbs }, (_, i) => (
<SliderPrimitive.Thumb
key={i}
aria-label={thumbs > 1 && label ? `${label} ${i + 1}` : label}
aria-describedby={description}
className="block size-4 rounded-full border border-primary bg-background shadow-sm transition-[box-shadow,scale] duration-150 ease-power3-out outline-none hover:ring-4 hover:ring-primary/15 focus-visible:ring-4 focus-visible:ring-ring/40 active:scale-110 disabled:pointer-events-none motion-reduce:active:scale-100"
/>
))}
</SliderPrimitive.Root>
);
}Usage
import { Slider } from "@/components/ui/slider"Exports
Slider
Dependencies
radix-ui@^1.8.1(npm)@vcare/utils(registry)
Raw item: /r/slider.json