Skip to content
↑↓ to navigate↵ to openesc to close

Menu

Before After Slider

Preview

Lake house at dawn, color graded
Lake house at dawn, unedited

Install

Add it with your package manager, or copy the source manually.

Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide

bunx --bun shadcn-vue@latest add @beui-vue/before-after-slider

Import the shared styles once in your application.

TSUsage
import BeforeAfterSlider from '@/components/beui/BeforeAfterSlider.vue'
import '@/components/beui/styles.css'

API Reference

#before?
slot

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

Default—
#after?
slot

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

Default—
v-model?
number

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

Default—
defaultValue?
number

Starting position when uncontrolled.

Default50
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?
{ label?: string; before?: string; after?: string; valueText?: string }
Default—
class?
string

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

Default—
@value-change?
(value: number) => void
Default—

Updated