[data-reveal]{opacity:1!important;transform:none!important}
Grid
Components

Grid

A responsive grid of rows and columns that drops columns on narrow screens — the layout of every dashboard.

Grid lays its rows out as a CSS grid. Each GridRow is a row, and its children spread across equal-width columns. The column count follows the densest row, so a two-item row and a three-item row align to one three-column track. Columns never shrink below minColumnWidth: on a narrow screen the grid drops columns and the cells wrap, down to one column on a phone.

GridGrid
Connecting to the DMS preview…
ConnectingDMS 0.9.51 option set

Usage

A Grid's direct children must be GridRows; the blocks go inside the rows.

src/pages/dashboard.ts
import { Grid, GridRow } from "@antelopejs/interface-dms/base/grid";
import { KpiCard } from "@antelopejs/interface-dms/base/kpi-card";
import { ChartCard } from "@antelopejs/interface-dms/base/chart-card";
import { ChartArea } from "@antelopejs/interface-dms/base/chart";

static dashboard = Grid({ minColumnWidth: "240px" })
  .child(
    "kpis",
    GridRow()
      .child("revenue", KpiCard({ title: "Revenue", fetchUrl: "/api/sales/revenue", periodScope: "sales" }))
      .child("orders", KpiCard({ title: "Orders", fetchUrl: "/api/sales/orders", periodScope: "sales" })),
  )
  .child(
    "charts",
    GridRow().child(
      "sales",
      ChartCard({ title: "Sales", fetchUrl: "/api/sales/series", periodScope: "sales", chart: ChartArea() }),
      { colSpan: 2 },
    ),
  );

Options

Options of the Grid block
OptionTypeDefaultDescription
gapLayoutstring"1rem"Gap between rows and columns, as a CSS length.
minColumnWidthLayoutstring"240px"Width below which a column is dropped, as a CSS length.

GridRow() takes no options: it is a row marker. Its children accept one piece of child metadata, colSpan:

Grid rowGridRow
Connecting to the DMS preview…
ConnectingDMS 0.9.5
The options of GridRow appear here once the DMS block catalog is available.
Child metadataTypePurpose
colSpannumberColumns the cell spans. Never more than the columns left at the current width.

Recipes

Line cells up with a spacer

A Spacer in a row holds an empty cell, so the next cells line up with the columns above. Once the grid has dropped columns there is nothing to line up with, so the spacer hides instead of taking a row of its own.

Nest any block

Any block may sit in a row, including stacks, tabs or a nested grid. The responsive behavior is pure CSS (container queries on the grid's own width), so the server-rendered page is already laid out the way the browser keeps it.

Pitfalls

Put blocks inside a GridRow, never directly under Grid. The block catalog declares GridRow as the only child Grid accepts, so the page editor and the dms-ai assistant refuse anything else, and the grid only lays out its rows.
  • A colSpan: 3 cell on a phone takes the single column rather than pushing the row off screen. Do not rely on spans for meaning.

Next steps

Stacks

Rows and columns of blocks without a grid track.

Period selector

Drive every card of the grid with one date range.