GodUI

Image Compare

A draggable before/after slider with clip-path reveal, keyboard support, and a pulsing handle hint.

Black and white
B&WColor

Vertical

Black and white

Installation

pnpm dlx shadcn@latest add "https://godui.design/r/image-compare.json"

Usage

tsx
 
import { ImageCompare } from "@godui/components";

<ImageCompare
  before={<img src="/before.jpg" alt="Before" />}
  after={<img src="/after.jpg" alt="After" />}
/>;

Drag the handle, or focus it and use the arrow keys (hold Shift for larger steps).

Props

PropTypeDefaultDescription
beforeReactNodeContent revealed on the left/top.
afterReactNodeBase content underneath.
initialnumber50Starting handle position (0–100).
orientation"horizontal" | "vertical""horizontal"Drag axis.
beforeLabelstringBadge over the before layer.
afterLabelstringBadge over the after layer.
onChange(position: number) => voidFires as the handle moves.

On this page

Built with GodUI

Beautifully crafted motion components for modern interfaces.

Star on GitHub