Components / component

Before After Slider

Two photos with a divider you can drag, click or move with the arrow keys to compare them.

Before After Slider demo

Implementation

Two photos with a divider you can drag, click or move with the arrow keys to compare them.

Framework
React 19.3.1 with TypeScript
Motion
Native CSS and browser APIs. No GSAP required.
Available modes
build
Version
1.0.0 · published

Source code

Loading source…

Quality evidence

Export tested in 2 consumer projects with chromium, firefox, webkit. Evidence recorded on .

Changelog

v1.0.0 · Two photos with a divider you can drag, click or move with the arrow keys to compare them.

Frequently asked questions

Can the slider be used without a mouse?

Yes. The handle is a slider with arrow key, Home and End support, and it reports its value as text for screen readers.

Do the two photos need to match?

They should have the same framing and aspect ratio, so the divider reveals the same scene in both.