Skip to content
VenusUI
Get started

Before/After Hero

A split hero with a draggable before/after comparison of your product's effect.

Preview

Installation

npx shadcn@latest add @venusui/hero-06

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/image-compare.tsxfrom image-compare
  • @/components/hero-06.tsx

Also adds the shadcn button component if your project doesn't have it yet.

Usage

The code behind the preview above.

hero-06-demo.tsx

import { Hero06 } from "@/components/hero-06"

export default function Hero06Demo() {
  return <Hero06 />
}

API reference

No props. Copy and the two comparison layers are in the file.

Requirements

  • shadcn button and VenusUI image-compare. The CLI installs both.
  • React 19 and Tailwind CSS v4.

Customization

  • Replace the two Placeholder layers with screenshots of the same size: <img src="/before.png" alt="…" className="size-full object-cover" />.
  • Change the starting split with defaultPosition.

Accessibility

  • The divider is a labelled range input (arrows, Home, End).
  • Give real screenshots meaningful alt text describing what changed.

Troubleshooting

Screenshots don’t line up.
Use two images with identical dimensions and object-cover on both.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.