Comparison
Comparison places left and right content behind a draggable or hover-controlled boundary.
Practical React example
Compare two versions of an image with an explicit divider and equivalent text descriptions.
Before you copy and paste
Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/comparison/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: lucide-react, motion.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Compare two versions of an image with an explicit divider and equivalent text descriptions
// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";
import { Comparison, ComparisonHandle, ComparisonItem } from "@/components/kibo-ui/comparison";
import Image from "next/image";
const Example = () => (
<Comparison className="aspect-video">
<ComparisonItem className="bg-red-500" position="left">
<Image
alt="Placeholder 1"
className="opacity-50"
height={1080}
src="https://placehold.co/1920x1080?random=1"
unoptimized
width={1920}
/>
</ComparisonItem>
<ComparisonItem className="bg-blue-500" position="right">
<Image
alt="Placeholder 2"
className="opacity-50"
height={1440}
src="https://placehold.co/2560x1440?random=2"
unoptimized
width={2560}
/>
</ComparisonItem>
<ComparisonHandle />
</Comparison>
);
export default Example;
Usage example adapted from Kibo UI's pinned MIT source. Retain the source licence notices when copying.
Use media with matching dimensions and reserve the comparison region’s aspect ratio. Explain what changed in nearby text so the result is understandable without moving the handle.
Customization
- ComparisonProps.mode
- Optional; "hover" | "drag".
- ComparisonProps.onDragStart
- Optional; () => void.
- ComparisonProps.onDragEnd
- Optional; () => void.
- ComparisonItemProps.position
- Required; "left" | "right".
- ComparisonHandleProps.children
- Optional; ReactNode.
Integration notes
- A comparison slider is not an image editor and does not save a chosen crop or transformation.
- Offer an ordinary way to inspect both images when dragging or hovering is unavailable.
Component source: Kibo UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.