Skip to content
Interactive

HoverCompare

Two versions of one picture with a line between them. The line follows the mouse without a press, a finger on touch, and the arrow keys. The labels hide as the line passes them.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
beforeReactNode—Shown left of the line. Same size as after.
afterReactNode—Shown right of the line.
startnumber50Where the line starts, 0 to 100.
beforeLabelstring"Before"Pill on the left.
afterLabelstring"After"Pill on the right.
labelstring"Compare two versions"Read by screen readers.
classNamestring"aspect-video"Set the size here.