Compare

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

first image
second image

Installation

Run the following command

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

Examples

Standard

first image
second image

Autoplay

first image
second image

Drag Mode

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

200+ templates and blocks combined

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

Aceternity UI Pro Demo - Light Mode

Access an ever-growing collection of premium, meticulously crafted templates and Component Blocks.

A product by Aceternity
Building in public at @mannupaaji

© 2026 Aceternity Labs LLC. All Rights Reserved.