Comparison Slider
Drag a divider to reveal a before/after comparison of two layers.
Import
tsx
import { ComparisonSlider } from "@cooud-ui/ui";
bash
npx cooud-ui add comparison-slider
Examples
API Reference
Generated from the component's exported types.
ComparisonSliderProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "onChange">
| Prop | Type | Default | Description |
|---|---|---|---|
before* | ReactNode | — | Content shown on the left, revealed by the clip (typically the "before" image). |
after* | ReactNode | — | Content shown as the full base layer (typically the "after" image). |
defaultPosition | number | 50 | Initial divider position as a percentage (0–100). Uncontrolled. |
position | number | — | Controlled divider position as a percentage (0–100). |
onPositionChange | (position: number) => void | — | Called with the next position when the divider moves. |
aria-label | string | — | Accessible name for the divider handle. |