Ballmac UI home

Masonry Grid

A gap-free multi-column layout for tiles of different heights, built on CSS columns so it never shifts on load, with responsive column counts and optional reveal.

Morning light
Workshop
Harbor
Studio wall
Field notes
Sketch
Terrace
Market
Ceramics

Installation

$ pnpm dlx shadcn@latest add @ballmac/masonry-grid

Usage

import { MasonryGrid, MasonryItem } from "@/components/ballmac/masonry-grid"

The full example is in the Code tab above.

Examples

Notes

Ship small

Release the smallest useful change, then learn from it.

Write it down

A short note today saves a long meeting next month. Keep the feedback loop short so you notice problems early.

Name things well

Good names make code, files and plans easier to follow.

Review early

Share drafts while they are still easy to change. Keep the feedback loop short so you notice problems early.

Measure one thing

Pick a single number that tells you if it worked.

API reference

PropTypeDefault
columns

Number of columns, or a count per breakpoint: `{ base: 1, sm: 2, lg: 4 }`.

MasonryColumns{ base: 1, sm: 2, lg: 3 }
gap

Space between items.

keyof typeof GAPS"md"
reveal

Fade items up as they scroll into view. Off under reduced motion.

booleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Tab orderFollows DOM order, which matches the visual column flow
Reduced motionReveal animation is skipped

Use with AI

<MasonryGrid columns={{base:2, lg:4}} gap reveal><MasonryItem/>…</MasonryGrid>. DOM order is reading order: down the first column, then the next. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Masonry Grid (@ballmac/masonry-grid) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Galleries, portfolios and boards
  • Testimonials or notes of uneven length

Not for

  • Rows that must line up across columns; use CSS grid
  • Sortable boards; use kanban-board

Registry JSON: https://ui.ballmac.com/r/masonry-grid.json

Credits

Free to use in personal and commercial projects.