Skip to content
ReactHive

Lens Slider

One screen of projects with a window in the middle: the same picture, closer, in a frame. Swipe or scroll and the next project wipes in over the screen while, a beat later and quicker, it wipes in inside the window, so the two layers pass like panes of glass. One gesture, one project, and it loops for ever. The window drifts toward the pointer and the picture in it the other way.

SlidersReactHive OriginalNo packages, just React and Tailwind CSS
Lens SliderSliders

How It Works

Every slide is in the page twice, once full screen and once in the window, each stack with the current slide on top. A gesture moves one slide: the incoming one is raised above the rest and its clip-path opens from the edge you're travelling from (the side the swipe came from, or the bottom for the wheel), with the picture inside easing in from a short way off, while the one it covers drifts on the other way. The window's wipe starts later and runs quicker, which is what makes the layers read as separate panes. A swipe fires once it has travelled a short way or ends in a quick flick, and the rest of that gesture is ignored; while a change plays out, new gestures wait. The wheel steps only on a pause in its events or a fresh, harder push, so a trackpad's long glide is still one slide. A lerped pointer moves the frame one way and the picture inside it the other.

Use It

Install it with shadcn, or copy the file into your components folder, then use it like this. Change a setting in the demo and the example picks it up. Works with Next.js (App Router) and any React 19 project on Tailwind CSS v4.

npx shadcn@latest add @reacthive/lens-slider
Example
<LensSlider slides={[{ src, alt, title, caption }]} />
  • slides is a list of { src, alt, title, caption?, ink? }; landscape photos fill best. ink is the colour of the type over that picture: light (white, the default) or dark for pale pictures, and the type and its soft shade change with the slide. It fills one screen and loops: swipe in any direction, with a finger or the mouse, or turn the wheel, and it moves one slide per gesture. Left and up go on, right and down go back. Made to fill the screen: while it's only partly in view, the wheel is left to the page.
  • zoom is how much closer the window looks than the full-screen picture (1.7 by default). The window is a portrait frame, a fifth of the width on desktop and wider on phones.
  • Bottom right are a count, a bar per project (click one to go straight to it) and previous and next buttons. It takes focus, and the arrow keys move between projects. The current project is announced to screen readers as it changes. With reduced motion the slides cross-fade and nothing drifts.
  • No packages: two stacks of plain images, wiped with clip-path through the Web Animations API, so the previous picture always stays underneath and there is never a gap.

Lens Slider, Answered.

Free to use, what it needs and where it came from.

Your Next Site Starts with a Live Demo.

Click around first. What you see is exactly what you download.

Start a Project

Tell us what you're making. A few lines is plenty; we'll ask the rest on a call.

What do you need?
Rough budget (optional)

Or email projects@reacthive.dev