Compare Slider

Before and after, split by a handle: for edits, upscales and variations.

Upscaled result
Low resolution input
InputUpscaled

In use

The Image Edit Studio's Compare: a version against its parent. Run an edit, then press Compare.

Lumen
CreateEditVideo
240 credits
the image

Paint over what to change. Tab reaches the marks: arrow keys move one, Enter edits its note, Delete removes it.

Installation

pnpm dlx shadcn@latest add https://mgp.paukraft.com/r/compare-slider.json

CompareSlider

PropTypeDefault
beforestring

Image left of the handle.

—
afterstring

Image right of the handle.

—
beforeLabel / afterLabelReactNode

Corner tags; they fade as the handle covers them. Pass null to hide.

"Before" / "After"
beforeAlt / afterAltstring

Describe each image.

—
position / defaultPositionnumber

0–100 from the left. Controlled with onPositionChange.

50
aspectRationumber | string

A number, CSS "16 / 9", or the API's "16:9".

—

Parts

Compose your own from the parts, e.g. to compare two loaders while a variation generates.

PropTypeDefault
CompareSliderRootposition, aspectRatio, …

Frame and slider. Drag anywhere; arrow keys on the handle.

—
CompareSliderAfterchildren

The full frame. Any media: an image, a video, a loader.

—
CompareSliderBeforechildren

Clipped to the left of the handle.

—
CompareSliderLabel{ side: "before" | "after" }

A corner tag.

—
CompareSliderHandlearia-label

Divider and grip.

—
useCompareSlider() => { position }

For your own layers.

—