Row Masonry
Greedy dynamic row-by-row masonry balancer placing items into the shortest column with GPU translate3d positioning.
Interactive Specification & Studio
Greedy Column Balancer
Dynamic shortest-column placement
GPU Translate3D Flow
Hardware-composited smooth transforms on resize without layout thrashing or inline top/left DOM recalculations.
Row-order bin-packing guarantees authentic left-to-right reading flow with zero cumulative layout shift.
Greedy Column Bin-Packing
Batched DOM height reads in a single animation frame to eliminate layout recalculation cascades.
<RowMasonry
columns={3}
gap={16}
/>Spatial Void Elimination
Items continually pack into the shortest column height, maintaining balance even as item content resizes dynamically.
DOM Order Flow Integrity
Keyboard tab sequence preserved
Quick Start & Consumer Example
Copy-paste ready implementation for React (.tsx). Automatically updates when you modify parameters in the Workbench above.
import React from 'react';
import { RowMasonry, RowMasonryItem } from '@/components/ui/RowMasonry';
const CARDS = [
{ id: '01', title: '120 FPS Native Kinetics', desc: 'Hardware-composited smooth transforms on resize.', height: 'h-40' },
{ id: '02', title: 'Greedy Column Balancer', desc: 'Dynamic shortest-column placement algorithm.', height: 'h-60' },
{ id: '03', title: 'Reading Order Preservation', desc: 'Row-order bin-packing guarantees authentic DOM flow.', height: 'h-48' },
{ id: '04', title: 'Zero Layout Shift', desc: 'Single-frame batched DOM height reads eliminating reflow.', height: 'h-72' },
];
export default function RowMasonryDemo() {
return (
<RowMasonry
columns={1}
columnsSm={2}
columnsMd={2}
columnsLg={3}
columnsXl={4}
gap={16}
className="max-w-5xl mx-auto p-6"
>
{CARDS.map((card) => (
<RowMasonryItem key={card.id}>
<div className={`border border-border bg-card rounded-xl p-5 ${card.height} flex flex-col justify-between`}>
<span className="text-xs font-mono text-muted-foreground">#{card.id}</span>
<div>
<h4 className="text-sm font-bold">{card.title}</h4>
<p className="text-xs text-muted-foreground mt-1">{card.desc}</p>
</div>
</div>
</RowMasonryItem>
))}
</RowMasonry>
);
}
Props & Configuration
Exhaustive parameter contract for Row Masonry. Validated in the live Studio workbench above and statically checked across all 13 ecosystem templates.
| Prop | Type | Default | Description |
|---|---|---|---|
columns | number | 1 | Base column count on mobile viewports (<640px). |
columnsSm | number | 2 | Number of columns on small tablet viewports (≥640px). |
columnsMd | number | 2 | Number of columns on medium tablet viewports (≥768px). |
columnsLg | number | 3 | Number of columns on desktop viewports (≥1024px). |
columnsXl | number | 4 | Number of columns on large screens (≥1280px). |
gap | number | 16 | Spacing between masonry columns and items. |
Base column count on mobile viewports (<640px).
Number of columns on small tablet viewports (≥640px).
Number of columns on medium tablet viewports (≥768px).
Number of columns on desktop viewports (≥1024px).
Number of columns on large screens (≥1280px).
Spacing between masonry columns and items.
Component Source
Component source definition for React (.tsx). Toggle between the clean wrapper and the standalone ejected engine micro-kernel.
import * as React from 'react';
import * as RowMasonryPrimitive from '@exhuma/core';
import { clsx } from 'clsx';
export interface RowMasonryProps extends React.ComponentPropsWithoutRef<typeof RowMasonryPrimitive.RowMasonry> {
className?: string;
}
export const RowMasonry = React.forwardRef<HTMLDivElement, RowMasonryProps>(
({ className, children, ...props }, ref) => (
<RowMasonryPrimitive.RowMasonry
ref={ref}
className={clsx(
'w-full relative',
className
)}
{...props}
>
{children}
</RowMasonryPrimitive.RowMasonry>
)
);
RowMasonry.displayName = 'RowMasonry';
export const RowMasonryItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, children, ...props }, ref) => (
<RowMasonryPrimitive.RowMasonryItem
ref={ref}
className={clsx('w-full', className)}
{...props}
>
{children}
</RowMasonryPrimitive.RowMasonryItem>
)
);
RowMasonryItem.displayName = 'RowMasonryItem';
Lifecycle Safety & Performance
Engineered for high-frequency user interactions with zero memory leaks.
Deterministic Cleanup
GPU Compositor Acceleration
will-change: transform without triggering browser layout recalculations.Accessibility Considerations
Fully compliant with WCAG guidelines and respects user motion preferences.
prefers-reduced-motion Support
prefers-reduced-motion: reduce enabled in their operating system, Exhuma components automatically disable 3D gyroscope tilt and spring animations, rendering static accessible content.