masonix

Getting Started

Install Masonix and render a responsive masonry layout with real cards.

Masonix gives you three React components for masonry layouts: a lightweight CSS-first grid, a measured balanced layout, and a virtualized feed for large lists. Start with the smallest component that fits the job, then move up only when the layout needs measurement or virtualization.

Install

npm install masonix

Masonix supports React 18 and React 19. It ships layout behavior only; your app owns card markup, imagery, styling, and data loading.

First layout

import { Masonry } from 'masonix';

type Task = {
  id: string;
  title: string;
  detail: string;
  area: string;
  status: string;
  accent: string;
};

function TaskCard({ task }: { task: Task }) {
  return (
    <article className="relative overflow-hidden rounded-xl border bg-white p-4 shadow-sm">
      <div
        className="absolute inset-y-0 left-0 w-1"
        style={{ background: task.accent }}
      />
      <div className="flex items-center justify-between gap-3 pl-2">
        <span className="text-xs font-medium text-zinc-500">{task.area}</span>
        <span className="rounded-full bg-zinc-100 px-2 py-1 text-xs">
          {task.status}
        </span>
      </div>
      <div className="pl-2 pt-2">
        <h3 className="text-sm font-semibold">{task.title}</h3>
        <p className="mt-2 text-sm leading-6 text-zinc-500">{task.detail}</p>
      </div>
    </article>
  );
}

export function TaskGrid({ tasks }: { tasks: Task[] }) {
  return (
    <Masonry
      items={tasks}
      columnWidth={190}
      maxColumns={3}
      gap={14}
      itemKey={(task) => task.id}
      render={({ data }) => <TaskCard task={data} />}
    />
  );
}
ReleaseReady

Launch plan

Milestones, owners, and final QA notes for the public release.

DesignReview

Brand board

Palette, type scale, and image direction for campaign pages.

ResearchNew

Research notes

Five customer interviews summarized into product opportunities.

GrowthDone

Metrics review

Activation moved up after the onboarding card refresh.

ProductPlanning

Roadmap

Small bets that improve feed performance and editorial control.

SupportOpen

Support themes

Repeated tickets grouped by install, styling, and virtualization.

Choose a component

GoalComponentImport
Simple responsive grids with no runtime measurementMasonrymasonix
Mixed-height cards that should visually balanceMasonryBalancedmasonix
Long feeds where rendering everything is expensiveMasonryVirtualmasonix/virtual

Practical defaults

  • Use itemKey for stable identity, especially when filtering or reordering.
  • Use columnWidth when the layout should adapt to available container width.
  • Use breakpoint maps when the product design calls for exact column counts.
  • Use getItemHeight when image dimensions are known before render.

Open the playground to compare column strategies, measured heights, virtualization, scroll seek, and imperative scrolling.

Next steps

On this page