Kinetic UI
Back to Introduction
General

Masonry Grid

Pinterest-style grid for galleries and portfolios.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add masonry-grid
masonry-grid
Photography
Branding
UI Design
Development
Motion
Illustration
Typography
Architecture

Overview

A responsive, performant masonry layout using CSS multi-columns. This ensures items of varying heights fit perfectly without awkward gaps, avoiding the heavy JavaScript calculations of traditional masonry libraries.

Usage

import { MasonryGrid } from "@/components/creative/masonry-grid"
<MasonryGrid
  columnWidth={250}
  gap={4}
  animate={true}
>
  <img src="/tall.jpg" alt="" />
  <img src="/short.jpg" alt="" />
  <img src="/medium.jpg" alt="" />
  {/* More items */}
</MasonryGrid>

Usage Guide

1. Import the Component

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

import { MasonryGrid } from "@/components/creative/masonry-grid";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { MasonryGrid } from "@/components/creative/masonry-grid";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <MasonryGrid
        columnWidth="example"
        gap{10}
        animate{true}
      >
        <div>Content goes here</div>
      </MasonryGrid>
    </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.