This component no longer exists. It was in diceui/base’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-13 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
compare-slider
diceui-base/compare-sliderRemovedComponent
diceui/base publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/base-vega/compare-slider.jsonSource
1"use client";23import { mergeProps } from "@base-ui/react/merge-props";4import { useRender } from "@base-ui/react/use-render";5import {6 ChevronDownIcon,7 ChevronLeftIcon,8 ChevronRightIcon,9 ChevronUpIcon,10} from "lucide-react";11import * as React from "react";12import { cn } from "@/lib/utils";13import { useAsRef } from "@/registry/bases/base/hooks/use-as-ref";14import { useIsomorphicLayoutEffect } from "@/registry/bases/base/hooks/use-isomorphic-layout-effect";15import { useLazyRef } from "@/registry/bases/base/hooks/use-lazy-ref";16import { useComposedRefs } from "@/registry/bases/base/lib/compose-refs";1718const ROOT_NAME = "CompareSlider";19const BEFORE_NAME = "CompareSliderBefore";20const AFTER_NAME = "CompareSliderAfter";21const LABEL_NAME = "CompareSliderLabel";22const HANDLE_NAME = "CompareSliderHandle";2324const PAGE_KEYS = ["PageUp", "PageDown"];25const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];2627type Interaction = "hover" | "drag";28type Orientation = "horizontal" | "vertical";2930type RootElement = React.ComponentRef<typeof CompareSlider>;3132function clamp(value: number, min: number, max: number): number {33 return Math.min(Math.max(value, min), max);34}3536interface StoreState {37 value: number;38 isDragging: boolean;39}4041interface Store {42 subscribe: (callback: () => void) => () => void;43 getState: () => StoreState;44 setState: <K extends keyof StoreState>(key: K, value: StoreState[K]) => void;45 notify: () => void;46}4748const StoreContext = React.createContext<Store | null>(null);4950function useStore<T>(51 selector: (state: StoreState) => T,52 ogStore?: Store | null,53): T {54 const contextStore = React.useContext(StoreContext);5556 const store = ogStore ?? contextStore;5758 if (!store) {59 throw new Error(`\`useStore\` must be used within \`${ROOT_NAME}\``);60 }6162 const getSnapshot = React.useCallback(63 () => selector(store.getState()),64 [store, selector],65 );6667 return React.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);68}6970interface CompareSliderContextValue {71 interaction: Interaction;72 orientation: Orientation;73}7475const CompareSliderContext =76 React.createContext<CompareSliderContextValue | null>(null);7778function useCompareSliderContext(consumerName: string) {79 const context = React.useContext(CompareSliderContext);80 if (!context) {81 throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);82 }83 return context;84}8586interface CompareSliderProps87// … truncated
What it pulls in
npm packages
Other registry items
