Before After Slider

Preview

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/before-after-slider

API Reference

before
ReactNode

Shown on the left of the divider, usually an image.

Default—
after
ReactNode

Shown on the right of the divider, usually an image of the same size.

Default—
value?
number

Divider position as a percent of the width, 0 to 100 (controlled).

Default—
defaultValue?
number

Starting position when uncontrolled.

Default50
onValueChange?
((value: number) => void)
Default—
showLabels?
boolean

Show the Before and After labels in the top corners.

Defaulttrue
hint?
boolean

Sweep the divider once when the slider first scrolls into view, to show it moves.

Defaulttrue
disabled?
boolean
Defaultfalse
labels?
Partial<{ label: string; before: string; after: string; valueText: string; }>
Default—
className?
string

Size the frame here; it defaults to a 3:2 box at full width.

Default—

Updated