Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Grid

Lay out child widgets in an N-column CSS grid; children flow row-major into columns equal columns.

Import

from manywidgets import Grid

Example

A 2-column grid of metric cards:

from manywidgets import Grid, Stat

Grid(
    Stat(label="Revenue", value=1234, unit="USD", delta=12),
    Stat(label="Users", value=987, delta=-3),
    Stat(label="Latency", value=42, unit="ms"),
    Stat(label="Uptime", value=99, unit="%", delta=1),
    columns=2, gap="12px",
)

API

TraitTypeDefaultDescription
childrenListChild widgets, in row-major order.
columnsInt2Number of equal-width columns.
gapUnicode'8px'CSS gap between cells.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).

Pass children positionally (Grid(a, b, c)) or as a list (Grid(children=[a, b, c])).

See Layout for how Row, Column, and Grid compose into a full screen.