Components
A before/after image comparison slider with a draggable handle, orientation and label support for revealing two overlaid states.
Loading preview...
import CompareSlider, {
CompareSliderAfter,
CompareSliderBefore,
CompareSliderHandle,
} from "@/components/ui/compare-slider";
export default function CompareSliderVerticalDemo() {
return (
<CompareSlider
defaultValue={50}
orientation="vertical"
className="h-[400px] w-full overflow-hidden rounded-lg border"
>
<CompareSliderBefore>
<img
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920&h=1080&fit=crop&auto=format&fm=webp&q=80"
alt="Before"
className="size-full object-cover"
/>
</CompareSliderBefore>
<CompareSliderAfter>
<img
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920&h=1080&fit=crop&auto=format&fm=webp&q=80&sat=-100"
alt="After"
className="size-full object-cover grayscale"
/>
</CompareSliderAfter>
<CompareSliderHandle />
</CompareSlider>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...