{"$schema":"https://ui.logic2b.com/schema/registry-item.json","name":"slider","type":"registry:ui","description":"An input where the user selects a value, or range of values, by dragging a handle within a track. Use for numeric ranges like volume or price, built on Radix Slider.","dependencies":["radix-ui"],"registryDependencies":["utils"],"files":[{"path":"ui/slider.tsx","type":"registry:ui","content":"\"use client\"\n\nimport * as React from \"react\"\nimport { Slider as SliderPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype SliderProps = React.ComponentProps<typeof SliderPrimitive.Root> & {\n  thumbLabels?: string[]\n}\n\nfunction Slider({\n  className,\n  defaultValue,\n  value,\n  min = 0,\n  max = 100,\n  thumbLabels,\n  \"aria-label\": ariaLabel = \"Slider value\",\n  \"aria-labelledby\": ariaLabelledBy,\n  ...props\n}: SliderProps) {\n  const _values = React.useMemo(\n    () =>\n      Array.isArray(value)\n        ? value\n        : Array.isArray(defaultValue)\n          ? defaultValue\n          : [min, max],\n    [value, defaultValue, min, max]\n  )\n\n  return (\n    <SliderPrimitive.Root\n      data-slot=\"slider\"\n      defaultValue={defaultValue}\n      value={value}\n      min={min}\n      max={max}\n      className={cn(\n        \"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\",\n        className\n      )}\n      {...props}\n    >\n      <SliderPrimitive.Track\n        data-slot=\"slider-track\"\n        className={cn(\n          \"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5\"\n        )}\n      >\n        <SliderPrimitive.Range\n          data-slot=\"slider-range\"\n          className={cn(\n            \"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full\"\n          )}\n        />\n      </SliderPrimitive.Track>\n      {Array.from({ length: _values.length }, (_, index) => (\n        <SliderPrimitive.Thumb\n          data-slot=\"slider-thumb\"\n          key={index}\n          aria-label={\n            ariaLabelledBy\n              ? undefined\n              : thumbLabels?.[index] ??\n                (_values.length > 1 ? `${ariaLabel} ${index + 1}` : ariaLabel)\n          }\n          aria-labelledby={ariaLabelledBy}\n          className=\"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50\"\n        />\n      ))}\n    </SliderPrimitive.Root>\n  )\n}\n\nexport { Slider }\n"}],"categories":["form"],"accessibility":{"support":"primitive","pattern":"slider","primitive":"Radix Slider","keyboard":[{"keys":["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],"action":"Move within the composite control."},{"keys":["Home","End","PageUp","PageDown"],"action":"Move the focused thumb by the supported increment."}],"aria":["Each thumb exposes slider value/min/max semantics and supports range sliders."],"consumer":["Provide a contextual aria-label or aria-labelledby for every thumb."]},"api":{"source":"src/ui/slider.tsx","exports":[{"name":"Slider","kind":"component","propsType":"SliderProps","props":[{"name":"min","type":"number","required":false,"default":"0"},{"name":"max","type":"number","required":false,"default":"100"},{"name":"thumbLabels","type":"string[]","required":false},{"name":"aria-label","type":"string","required":false,"default":"\"Slider value\""}]}]}}