About
Compare two images with a draggable divider. Drag or click anywhere on the frame, use the arrow keys, and keep vertical page scroll on touch.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Before After Slider to your project and fits it to your theme.
Code
How Before After Slider is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import { BeforeAfterSlider } from "@/components/ui/beui-before-after-slider"
const PHOTO =
"https://cdn.21st.dev/assets/mirror/15/15c2df47e059729d4b47d59b8cc4a9e48245b00475b793458ac200ffa7d88ab4.jpg";
export function BeforeAfterSliderPreview() {
return (
<div className="mx-auto w-full max-w-xl min-w-0 px-4 py-6">
<BeforeAfterSlider
before={
<img
src={PHOTO}
alt="Lake house at dawn, unedited"
draggable={false}
className="h-full w-full object-cover brightness-90 contrast-75 grayscale"
/>
}
after={
<img
src={PHOTO}
alt="Lake house at dawn, color graded"
draggable={false}
className="h-full w-full object-cover"
/>
}
/>
</div>
);
}
export default BeforeAfterSliderPreview








