Image Compare
image-compareTwo images split by a divider you drag from anywhere on the image: before and after, design and build, light and dark. To assistive technology the divider is a real slider, with arrow, Page and Home/End keys.
/* eslint-disable @next/next/no-img-element */
import { ImageCompare } from "@/components/forme/image-compare/image-compare";
export function ImageCompareDemo() {
return (
<ImageCompare
className="aspect-[4/3] w-full max-w-2xl"
beforeLabel="Raw"
afterLabel="Graded"
before={
<img
src="/images/coast.webp"
alt="The coastline before grading, flat and grey"
className="grayscale contrast-75 brightness-110"
/>
}
after={<img src="/images/coast.webp" alt="The coastline after grading, peach and violet" />}
/>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
ImageCompare
Two versions of an image, split by a divider you drag: before and after an edit, a design and its implementation, light and dark.
| Prop | Type | Default | Description |
|---|---|---|---|
before* | ReactNode | — | Shown on the left of the divider. |
after* | ReactNode | — | Shown on the right of the divider. |
beforeLabel | string | "Before" | |
afterLabel | string | "After" | |
defaultPosition | number | 50 | Starting position of the divider, 0–100. |
label | string | "Comparison divider" | Accessible name for the divider. |
className | string | — |
Related


Area Chart
A line or area chart in plain SVG with no chart library. A crosshair snaps to the nearest point and lists every series, arrow keys walk it, round tick values, a legend from two series up, and a hidden table so screen readers get the numbers.
data display

Avatar
A user image with a fallback that shows initials while the image loads, and when it never arrives at all. Built on the Base UI avatar primitive, so the image and the fallback swap without a flash of empty space.
data display

Badge
A small label for status, counts and metadata, in five quiet variants and two sizes. The colour lives in the tint so the text stays readable at eleven pixels, and an icon or a dot inside the badge carries the state at a glance.
data display
