A before/after slider is the most convincing thing you can put on a redesign page. The visitor drags a
divider and compares the old site with the new one themselves. It looks like it needs a drag library. It
doesn't: one <input type="range"> and one clip-path do the whole job.
The whole component
import { useState , type ReactNode } from "react" ;
export function BeforeAfter ( { before , after , } : { before : ReactNode ; after : ReactNode ; } ) { const [ split , setSplit ] = useState ( 50 ) ;
return ( < div className = "relative overflow-hidden rounded-xl" > < div > { after } </ div > < div className = "absolute inset-0" style = { { clipPath : `inset(0 ${100 - split}% 0 0)` } } > { before } </ div > < div className = "pointer-events-none absolute inset-y-0 w-px bg-blue-600" style = { { left : `${split}%` } } /> < input type = "range" min = { 0 } max = { 100 } value = { split } onChange = { ( event ) => setSplit ( Number ( event . target .…