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.

GridItem

Wrap a Grid child to control how many columns/rows its cell spans, or to place it into a named template_areas region. A bare (unwrapped) child stays a plain 1x1 cell, exactly like before; GridItem is opt-in.

Import

from manywidgets import Grid, GridItem

Example

One cell spanning 2 columns and 2 rows, in a 4-column grid. Every cell here is a plain bordered Stat card labeled with its own span, so the grid lines are visible directly from the cell borders:

Named areas (set template_areas on the Grid, and area= on each item) place a cell by name instead of row-major flow. Combine with template_rows and an explicit height on the Grid to give a middle row (here 1fr) more space than the thin header/footer bars; see Grid’s asymmetric-columns section for why height matters:

API

TraitTypeDefaultDescription
childInstance—The wrapped widget.
col_spanInt1Number of grid columns this cell spans.
row_spanInt1Number of grid rows this cell spans.
areaUnicode''Named grid-template-area; requires the parent Grid’s template_areas.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).

area takes precedence over col_span/row_span when the parent Grid has template_areas set.