Skip to content
Browse docs and components

Image Compare

image-compare

Two 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.

Responsive

Install

$npxshadcnadd@forme/image-compare

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.

PropTypeDefaultDescription
before*ReactNode—Shown on the left of the divider.
after*ReactNode—Shown on the right of the divider.
beforeLabelstring"Before"
afterLabelstring"After"
defaultPositionnumber50Starting position of the divider, 0–100.
labelstring"Comparison divider"Accessible name for the divider.
classNamestring—