Before/After Image Slider

Interactive image comparison component with a draggable divider supporting horizontal and vertical orientations. Perfect for showcasing transformations, photo editing results, or design improvements.

FREE

Reveal1: Before/After Image Slider

Draggable before/after image comparison slider: pointer and touch drag move a clip-path divider between two full-bleed images, with an accessible slider role and optional Before/After pill labels.

Free block

This block is free. No license or account is required: install it with the CLI and use it in unlimited projects.

Installation

Radix flavor

bash
npx shadcn add "https://ui.beste.co/r/reveal1"

Base UI flavor

bash
npx shadcn add "https://ui.beste.co/r-base/reveal1"

This installs the block to components/beste/block/reveal1.tsx and its dependencies.

Quick start

The installed file exports reveal1Demo alongside the block: the exact props behind the preview above. Spread it to get a working comparison slider in one line.

tsx
import { Reveal1, reveal1Demo } from "@/components/beste/block/reveal1";

export default function ShowcasePage() {
  return <Reveal1 {...reveal1Demo} />;
}

Then replace the demo with your own props. Written out, the same setup looks like this:

tsx
import { Reveal1 } from "@/components/beste/block/reveal1";

export default function ShowcasePage() {
  return (
    <Reveal1
      heading="Before and after"
      description="Drag the handle to compare the two states."
      beforeImage={{
        src: "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=1200&h=675&fit=crop&sat=-100",
        alt: "Before",
      }}
      afterImage={{
        src: "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=1200&h=675&fit=crop",
        alt: "After",
      }}
      orientation="horizontal"
    />
  );
}

Props

PropTypeDefaultDescription
headingstringOptional heading above the slider
descriptionstringOptional supporting copy above the slider
beforeImage{ src: string; alt: string }Required. Image clipped by the divider
afterImage{ src: string; alt: string }Required. Full-bleed background image
beforeLabelstring"Before"Pill label over beforeImage
afterLabelstring"After"Pill label over afterImage
orientation"horizontal" | "vertical""horizontal"Drag axis and divider orientation
initialPositionnumber50Starting divider position, 0-100
showLabelsbooleantrueToggles the Before/After pill labels
dividerWidthnumber4Divider bar thickness in pixels
classNamestringExtra classes for the outer <section>

Behavior notes

More Reveal blocks

View all Reveal
FREE

reveal2

Comparison Slider with Highlights

Split-layout image comparison with a sidebar featuring benefit highlights and icons alongside a draggable before/after slider. Perfect for demonstrating product improvements with detailed feature callouts.

PRO

reveal4

Scroll-Reveal Gallery

An editorial scroll-reveal gallery where images fade and rise into view with monospace captions and alternating rhythm.

PRO

reveal3

Manifesto Scroll Reveal

A type-forward manifesto whose ruled statement lines fade and rise into view as the section enters the viewport.

PRO

reveal5

Editorial Statement Reveal

A large light manifesto statement with an accent-highlighted phrase, an eyebrow above, and a supporting footnote plus outline button beneath a hairline rule.