Skip to content
ReactHive

Focus Grid

A wall of pictures edge to edge, seen through a lens: the column and row under the pointer open up while the rest give way, and the whole wall pans forever as you drag or scroll.

GalleriesReactHive OriginalNo packages, just React and Tailwind CSS
Focus GridGalleries

How It Works

Each axis is an even grid stretched by a bell curve of extra space centred on the pointer. Integrating the curve (with the error function) gives every grid line's position, so the tracks near the pointer grow, the far ones shrink, and they always add up to the screen. Panning slides the grid lines under the same lens, and a pool of tiles one track larger than the screen wraps round, changing picture only while off screen.

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/focus-grid
Example
<FocusGrid
  className="h-svh"
  items={projects.map((p) => ({ src: p.cover, title: p.name, credit: `By ${p.client}`, href: `/work/${p.slug}` }))}
/>
  • Give it a height with className (h-svh for a full-screen section). It fills its parent's width.
  • Drag or throw it, or scroll and swipe on a trackpad, and it pans in any direction without end. The wheel stays inside the grid while the pointer is over it; pass wheel={false} to let the page scroll instead.
  • Thirty or more pictures keep repeats far apart. Set video on an item to play a muted, looping clip in its tile.
  • Clicking a tile (not dragging) calls onSelect and follows its href. Keyboard users move it with the arrow keys and open the middle tile with Enter; screen readers get a plain list of the pictures.
  • On touch screens the lens rests in the middle, so tiles open up as you swipe them through it. With reduced motion it still answers the pointer, without easing, drift or throws.

Focus Grid, 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