Kinetic UI
Back to Introduction
Advanced Grids

Infinite Panning Grid

A 2D masonry grid that pans infinitely in all directions based on cursor position.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add infinite-panning-grid
Infinite Panning Grid

Infinite Panning

Move your mouse to explore the grid

Installation

npx kinetic-ui-cli@latest add infinite-panning-grid

How It Works

To achieve a true "infinite" pan without complex WebGL shaders, we utilize a 2x2 grid of identical cloned "tiles".

Inside a requestAnimationFrame loop, we accumulate X and Y translation based on the distance of the cursor from the center of the screen. When the translation offset exceeds the width/height of a single tile, we use modulo logic to seamlessly snap it back to 0.

Because we render a 2x2 grid, this sudden snap is completely invisible to the user, creating the illusion of infinite space.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { InfinitePanningGrid } from "@/components/creative/infinite-panning-grid";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { InfinitePanningGrid } from "@/components/creative/infinite-panning-grid";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <InfinitePanningGrid
        items{/* value */}
        speed{10}
      />
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.