Before / After Slider

Drag, tap or use the arrow keys to wipe between two states. The knob stretches while held, the reveal edge glows and the handle sweeps once on first view.

Try it: Drag the handle, click to jump, or focus it and use ←/→ (Shift = ±10, Home/End).

Installation

Install with the shadcn CLI:

npx shadcn@latest add https://www.framekitui.live/r/before-after-slider.json

Or, with the @framekit namespace registered: npx shadcn@latest add @framekit/before-after-slider. You can also copy the source into components/ui/before-after-slider.tsx (view on GitHub).

Usage

import { BeforeAfterSlider } from '@/components/ui/before-after-slider'

Props

Component props
PropTypeDefaultNotes
before / afterReactNodewireframe / polished mockLayers to compare (images, nodes…).
beforeLabel / afterLabelstring'Before' / 'After'Corner labels.
value / defaultValuenumber50Position 0–100 (controlled / uncontrolled).
onValueChange(v: number) => void—Fires while moving.
introbooleantrueSweep once when scrolled into view.
aspectstring'16 / 10'CSS aspect-ratio.
classNamestring—Extra classes merged onto the root.

Dependencies

  • motion
  • lucide-react
  • Career Timeline

    A vertical line that draws itself as you scroll with a glowing head; milestone nodes pop on springs and cards slide in from alternating sides.

  • Case Study Scroll

    Problem → Process → Result as a scroll-driven story: a sticky rail fills as you read and lights the current chapter while chapters rise in with staggered key figures.

  • Skills Marquee

    Two counter-rotating rails of skill pills. Hover or keyboard focus pauses, a visible Pause button covers touch and WCAG 2.2.2, and reduced motion becomes a calm wrapped list.

  • Project Filter Gallery

    Category chips share a sliding pill (layout animation) while the grid reflows: survivors glide to new cells, newcomers bloom in blur-to-sharp. Announces the result count.

  • Skill Meters

    Radial gauges that sweep to their value on scroll-in: glowing gradient arc, a comet dot on the tip and a live count-up. Staggered, replayable and exposed as ARIA meters.

  • Project Reveal List

    An editorial project index: rows dim their siblings and nudge on hover while a tilting preview chases the cursor on a spring and unmasks with a clip-path. Touch gets inline thumbnails.

See all 35 Portfolio components