Shipped
Wireframe
BeforeAfter

Compare Slider

Before and after split by a draggable divider.

Layout
Shipped
Wireframe
BeforeAfter

Installation

bash
npx shadcn@latest add https://ui.noicess.fun/r/compare-slider.json

Props

PropTypeDefaultDescription
before / afterReact.ReactNode-The two layers. Images should share dimensions.
initialnumber0.5Start position, 0 to 1.
beforeLabel / afterLabelstring"Before" / "After"Edge tags that fade as the divider nears.
onChange(position: number) => void-Called with the rounded position on move.