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 https://ui.aceternity.com/registry/compare.json https://ui.aceternity.com/registry/sparkles.json

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

With the best in class components and templates, stand out from the crowd and get more attention to your website. Trusted by founders and entrepreneurs from all over the world.

Go Pro
Excellent communication and professionalism from the start and throughout. Happily and calmly accepted and entertained a few additional out-of-scope requests as well. Good open-...

Henrik Söderlund

Former CTO at Creme Digital

A product by Aceternity
Building in public at @mannupaaji