Modus UI

Masonry Grid

Web (React)

A fully responsive, animated masonry layout powered by Framer Motion.

A fully responsive, animated masonry layout powered by Framer Motion. It automatically calculates column sizes based on screen width and provides stunning entrance animations with blur effects.

Installation

CLI

npx @modus-ui/cli add masonry-grid

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/masonry-grid.tsx.
  3. Paste the code.

Usage

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

export default function Example() {
  const items = [
    { id: 1, height: 300, content: <div className="h-full w-full rounded-xl bg-primary/20" /> },
    { id: 2, height: 200, content: <div className="h-full w-full rounded-xl bg-primary/40" /> },
    { id: 3, height: 400, content: <div className="h-full w-full rounded-xl bg-primary/60" /> },
  ];

  return <MasonryGrid items={items} animateFrom="bottom" stagger={0.05} />;
}

Props

PropTypeDefaultDescription
itemsMasonryItem[][]Array of objects containing id, height, and content.
animateFrom"top" | "bottom" | "left" | "right" | "center" | "random""bottom"Direction from which items animate in.
staggernumber0.05Delay interval between item animations.

Comments

  • No comments yet.