ReactHive

Focus Grid

Galleries 1

About

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.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Focus Grid to your project and fits it to your theme.

Code

How Focus Grid is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { FocusGrid, type FocusGridItem } from "@/components/ui/focus-grid";

const settings = {
  strength: 3,
  reach: 0.8,
  columns: 6,
  rows: 4,
  ease: 0.1,
  drift: 0,
  gap: 0
};

/* Photos from Unsplash (public/library/photos/CREDITS.md), credited to their photographers. */
const photos: [file: string, title: string, by: string][] = [
  ["orange-chair", "Orange Chair", "Erik Torres"],
  ["pink-blazer", "Pink Blazer", "Gabriel Silvério"],
  ["green-dancer", "Green Room", "Faheem Ahmed"],
  ["yellow-walk", "Saffron", "Jotavé Visual Culture"],
  ["red-sky", "Red Against Sky", "Marjan Taghipour"],
  ["magenta-hands", "Peek", "Ivan Aviles"],
  ["neon-crowd", "Night Street", "Dibakar Roy"],
  ["spinning-dress", "Spin", "Kevin Feller"],
  ["orange-sunglasses", "Citrus", "Ulla Shinami"],
  ["stage-dancers", "Light Trails", "Reilly Cook"],
  ["green-dress", "The Apple", "Igor Rand"],
  ["violet-blur", "Violet Hour", "Vladyslav Tobolenko"],
  ["yellow-blossom", "In Bloom", "Taylor Heery"],
  ["red-suit", "Red Suit", "Julian Myles"],
  ["pink-pair", "Pink Pair", "Tanya Layko"],
  ["orange-dancers", "Dance Floor", "Jurien Huggins"],
  ["blue-suit", "Blue Hour", "Anni Peng"],
  ["hair-flip", "Hair Flip", "Diksha Kajaria"],
  ["yellow-jacket", "Yellow Jacket", "Carlos Vaz"],
  ["beach-blur", "Coast Road", "Drew Tilk"],
  ["mina", "Mina", "Vladimir Fedotov"],
  ["leo", "Leo", "khaled elshamy"],
  ["clara", "Clara", "Kirill Balobanov"],
  ["grace", "Grace", "Luiz Rogério Nunes"],
  ["chapel-stair", "Chapel Stair", "Unsplash"],
  ["kyst-dusk", "Coast at Dusk", "Unsplash"],
  ["library-reading-room", "Reading Room", "Unsplash"],
  ["saltvaerket-windows", "Windows", "Unsplash"],
  ["fjordhus-waterfront", "Waterfront", "Unsplash"],
  ["school-courtyard", "Courtyard", "Unsplash"],
  ["ida", "Ida", "Unsplash"],
  ["anders", "Anders", "Unsplash"],
];

const items: FocusGridItem[] = photos.map(([file, title, by]) => ({ src: `https://reacthive.dev/library/photos/${file}.webp`, title, credit: `Photo by ${by}` }));

function DemoContent(props: Partial<typeof settings> = {}) {
  const v = { ...settings, ...props };
  return (
    <FocusGrid
      className="h-svh w-full"
      items={items}
      strength={Number(v.strength)}
      reach={Number(v.reach)}
      columns={Number(v.columns)}
      rows={Number(v.rows)}
      ease={Number(v.ease)}
      drift={Number(v.drift)}
      gap={Number(v.gap)}
      // Framed on the docs page the wheel scrolls the page; opened full screen it pans the grid.
      wheel={window.self === window.top}
    />
  );
}

/** The demo in its own colours, filling the frame. */
export default function Demo(props: Partial<typeof settings> = {}) {
  return (
    <div className="min-h-svh w-full" style={{ background: "#0a0a0b" }}>
      <DemoContent {...props} />
    </div>
  );
}

More by ReactHive

View all
  • Card Deal

    Card Deal

    289
  • Arc Gallery

    Arc Gallery

    194
  • Fluid Type

    Fluid Type

    174
  • Step Stack

    Step Stack

    120
  • Iris Scroll

    Iris Scroll

    95
  • Card Pack

    Card Pack

    73
  • Word Drum

    Word Drum

    58
  • Colour Wash Slider

    Colour Wash Slider

    49

More in Galleries

View all
  • Gallery Component

    Gallery Component

    48
  • Photo Deck

    Photo Deck

    80
  • Scattered About

    Scattered About

    80
  • Product Hover Showcase

    Product Hover Showcase

    121
  • Morph Gallery

    Morph Gallery

    4
  • Image Gallery

    Image Gallery

    97
  • Editorial Collage Hero

    Editorial Collage Hero

    530
  • About 3

    About 3

    459

Explore more

Part of ReactHive UI — browse the full library on 21st.dev.