pnpm dlx shadcn@latest add https://ui.saturation.io/r/comparison-slider.jsonTailwind v4 — Source Scanning
Saturation UI copies component source into your project via the shadcn registry (no npm package). If Tailwind v4 isn't scanning your components directory, add this to your CSS entry file:
@source "../components";This ensures all utility classes in CVA variants and data attribute selectors are included in your build.
import { ComparisonSlider } from "@/components/ui/comparison-slider"<ComparisonSlider
beforeImage={{ src: "/before.jpg", alt: "Before" }}
afterImage={{ src: "/after.jpg", alt: "After" }}
beforeLabel="Before"
afterLabel="After"
/>| Prop | Type | Default | Description |
|---|---|---|---|
beforeImage* | { src: string; alt: string } | — | Left/before image. |
afterImage* | { src: string; alt: string } | — | Right/after image. |
beforeLabel | string | "Before" | Label for the left side. |
afterLabel | string | "After" | Label for the right side. |
defaultPosition | number | 50 | Initial slider position (0-100). |
aspectRatio | string | "aspect-video" | Tailwind aspect ratio class. |
className | string | — | Additional CSS classes. |
On This Page
Drag to compare