Introducing Aceternity UI Pro - 70+ premium component packs and templates to build amazing websites.
Logo

Compare

A comparison component between two images, slide or drag to compare

Open in
first image
second image

Installation

Run the following command

npx shadcn@latest add @aceternity/compare @aceternity/sparkles

Examples

Standard

Open in
first image
second image

Autoplay

Open in
first image
second image

Drag Mode

Open in
first image
second image

Props

PropTypeDefaultDescription
firstImagestring""URL of the first image
secondImagestring""URL of the second image
classNamestringundefinedAdditional CSS classes for the container
firstImageClassNamestringundefinedAdditional CSS classes for the first image
secondImageClassnamestringundefinedAdditional CSS classes for the second image
initialSliderPercentagenumber50Initial position of the slider (0-100)
slideMode"hover" | "drag""hover"Mode of interaction for the slider
showHandlebarbooleantrueWhether to show the slider handle
autoplaybooleanfalseEnable automatic sliding
autoplayDurationnumber5000Duration of one autoplay cycle in milliseconds

Build websites faster and 10x better than your competitors with

Aceternity UI Pro

Next.js 15, Tailwind CSS v4 and Motion for react powered templates

70+ templates and component blocks combined

Ready to copy paste component blocks, save days of development time

Aceternity UI Pro Demo - Light Mode
A product by Aceternity
Building in public at @mannupaaji