Slider Glass
shadcn-glass-ui/slider-glassFreeComponent
Glass-themed range slider built on Radix UI with shadcn/ui compatible API:
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/slider-glass.jsonSource
1/**2 * SliderGlass Component3 *4 * Glass-themed range slider built on Radix UI with shadcn/ui compatible API:5 * - Theme-aware styling (glass/light/aurora)6 * - Glow effect on hover/drag7 * - Gradient fill (glass theme)8 * - Range slider support (multiple thumbs)9 * - Optional label and value display10 *11 * **shadcn/ui compatible props:**12 * - `value` / `defaultValue` - Array of values (supports range)13 * - `onValueChange` - Callback when values change14 * - `onValueCommit` - Callback when interaction ends15 *16 * @example17 * ```tsx18 * // Single value (controlled)19 * <SliderGlass value={[50]} onValueChange={setValue} />20 *21 * // Range slider22 * <SliderGlass defaultValue={[25, 75]} />23 *24 * // With label and value display25 * <SliderGlass value={[50]} onValueChange={setValue} label="Volume" showValue />26 * ```27 */2829import { forwardRef, type CSSProperties, type ComponentPropsWithoutRef } from 'react';30import * as SliderPrimitive from '@radix-ui/react-slider';31import { cn } from '@/lib/utils';32import { FormFieldWrapper } from '@/components/glass/primitives';33import '@/glass-theme.css';3435// ========================================36// PROPS INTERFACE37// ========================================3839export interface SliderGlassProps extends Omit<40 ComponentPropsWithoutRef<typeof SliderPrimitive.Root>,41 'value' | 'defaultValue' | 'onValueChange'42> {43 /**44 * Controlled value (shadcn/ui compatible - array for range support)45 */46 readonly value?: number[];47 /**48 * Default value for uncontrolled usage (array for range support)49 */50 readonly defaultValue?: number[];51 /**52 * Callback when value changes (shadcn/ui compatible)53 */54 readonly onValueChange?: (value: number[]) => void;55 /**56 * Callback when interaction ends (mouse up / touch end)57 */58 readonly onValueCommit?: (value: number[]) => void;59 /**60 * Show current value(s) next to label61 */62 readonly showValue?: boolean;63 /**64 * Optional label text65 */66 readonly label?: string;67 /**68 * Error message to display69 */70 readonly error?: string;71 /**72 * Success message to display73 */74 readonly success?: string;75}7677// ========================================78// COMPONENT79// ========================================8081export const SliderGlass = forwardRef<82 React.ComponentRef<typeof SliderPrimitive.Root>,83 SliderGlassProps84>(85 (86 {87 className,88 value,89 defaultValue,90 onValueChange,91 onValueCommit,92 min = 0,93 max = 100,94 step = 1,95// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alert Glassalert-glass | shadcn-glass-ui | Components | Free | no deps | |
| Animated Background Glassanimated-background-glass | shadcn-glass-ui | Components | Free | no deps | |
| Avatar Glassavatar-glass | shadcn-glass-ui | Components | Free | no deps | |
| Badge Glassbadge-glass | shadcn-glass-ui | Components | Free | no deps | |
| Base Progress Glassbase-progress-glass | shadcn-glass-ui | Components | Free | no deps | |
| Button Glassbutton-glass | shadcn-glass-ui | Components | Free | no deps | |
| Card Glasscard-glass | shadcn-glass-ui | Components | Free | no deps | |
| Checkbox Glasscheckbox-glass | shadcn-glass-ui | Components | Free | no deps |
