Skip to main content
Version: 1.0.2

AutoGrid

Overview

The AutoGrid component automatically determines the number of columns based on the available container width and a defined minimum item width.
It’s ideal for dynamic content, responsive galleries, and layouts where the number of items is unknown.

Preview

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

Installation

npx @mindfiredigital/ignix-ui add auto-grid

Variants

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

Usage

function Gallery() {
return (
<AutoGrid minItemWidth="200px" maxColumns={6} gap="small" balanced>
{images.map((src, i) => (
<img key={i} src={src} className="rounded shadow" />
))}
</AutoGrid>
);
}

Tags or Categories

function TagList({ tags }) {
return (
<AutoGrid minItemWidth="120px" gap="comfortable">
{tags.map((tag, i) => (
<span key={i} className="px-3 py-1 rounded bg-gray-200">
{tag}
</span>
))}
</AutoGrid>
);
}

Props

PropTypeDefaultDescription
minItemWidthstring"200px"Minimum width of each grid item before wrapping.
maxColumnsnumberInfinityMaximum number of columns allowed.
gap"small" | "normal" | "large" | string"normal"Gap between grid items.
balancedbooleanfalseEnsures balanced column heights (ideal for masonry-like layouts).