Introducing shieldcn — README badges, shadcn style.

Check it out

Pretext Masonry Grid

Text-aware masonry layout where card heights are predicted by Pretext without DOM measurement. Zero layout shift.

@chenglou/pretext

Installation

$ shadcn add @jalco/masonry-grid

Usage

import { MasonryGrid } from "@/components/masonry-grid"
<MasonryGrid items={items} columns={3} />

Client component. Each card's text height is computed by Pretext using pure arithmetic. Cards are absolutely positioned into columns — no DOM measurement, no layout shift.

Examples

Three columns

API Reference

MasonryGrid

PropType

MasonryItem

PropType

Notes

  • Pretext-powered. Uses @chenglou/pretext for pure-arithmetic height prediction.
  • Zero layout shift. Cards are positioned using computed heights, not DOM measurements. No reflow, no CLS.
  • Responsive. Uses ResizeObserver to recalculate positions when the container width changes.
  • Font matching. The font and lineHeight props must match the CSS styling of the card body text.