Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Primitives
  2. Grid
  3. API and Development

Grid

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Grid is a layout host for tokenized column and row tracks. It does not carry paint—put background, border, and content on Box (or other primitives) inside cells. Use template={GridTemplate.*} for product layouts instead of consumer grid-template-columns. Pair with GridItem when a child spans multiple tracks. For one-dimensional flex inside a cell (scroll hosts, toolbars), use Box / FlexBox item (FlexItem, alignSelf).
Key props
NameTypeDefaultDescription
templateGridTemplate—Column track template (equal, ratio, sidebar, queue metrics, auto-fill).
rowsGridRows—Row template.
flowGridFlowrowAuto-placement flow.
alignGridAlign—Align items.
justifyGridJustify—Justify content.
gapGridGap—Gap spacing scale.
collapseBelowGridCollapseBelow—Single column below a container width breakpoint.
displayGridDisplaygridgrid or inline-grid.
subgridGridSubgrid—Take column tracks, row tracks, or both from the parent Grid. Requires the span for each adopted axis.
columnSpanGridSpan—Column tracks this Grid covers in its parent Grid.
rowSpanGridSpan—Row tracks this Grid covers in its parent Grid.
See GridProps and GridItem in @prepared911/ui for the full surface.
GridTemplate
MemberTracks
EqualHalvesrepeat(2, minmax(0, 1fr))
EqualThirdsrepeat(3, minmax(0, 1fr))
EqualQuartersrepeat(4, minmax(0, 1fr))
EqualSixthsrepeat(6, minmax(0, 1fr))
EqualTwelfthsrepeat(12, minmax(0, 1fr))
EqualTenthsrepeat(10, minmax(0, 1fr))
TwoOneminmax(0, 2fr) minmax(0, 1fr)
ThreeOneminmax(0, 3fr) minmax(0, 1fr)
QueueMetricsStandardvar(--layout-queue-metrics-standard) minmax(0, 1fr) minmax(0, 1fr)
QueueMetricsEctvar(--layout-queue-metrics-ect) minmax(0, 1fr) minmax(0, 1fr)
SidebarStartMainvar(--layout-panel-fixed) minmax(0, 1fr)
MainSidebarEndminmax(0, 1fr) var(--layout-panel-fixed)
AutoFillMinItemrepeat(auto-fill, minmax(var(--layout-grid-auto-fill-min), 1fr))
FitStartMainfit-content(50%) minmax(0, 1fr)
Queue metric tokens resolve to 14.4375rem (standard) and 21.0625rem (ECT) at a 16px root.
Subgrid
A nested Grid normally sizes its own tracks. With subgrid, its children sit on the parent's tracks instead, so groups line up with each other. The nested Grid must be the parent's grid item, so the span goes on it: columnSpan for GridSubgrid.Columns, rowSpan for GridSubgrid.Rows, both for GridSubgrid.Both. The types require the span and reject own tracks (template, rows, collapseBelow) on an adopted axis.
GridSubgridAdoptsRequires
ColumnsParent column trackscolumnSpan
RowsParent row tracksrowSpan
BothParent column and row trackscolumnSpan and rowSpan
Gap. Leave gap unset on an adopted axis to keep the parent's gutter. A set gap replaces the gutter inside the subgrid, and its children still start on the parent's track edges. Paint. Grid has none, so a subgridded card puts its surface on the Box parts inside it.
Form label and field columns
Each section is a column subgrid spanning every parent column, so the labels in both sections share the parent's FitStartMain leading track and every input starts on the same edge. The parent's column gap of 8 is the label-to-control gap.
Card rows
Each card is a row subgrid spanning three parent rows, one per part, so headers, bodies and footers share rows across the cards. The long body grows its row for every card. gap={{ row: 0 }} on each card joins its painted parts; the parent's gap of 12 still separates the cards. AutoFillMinItem adds and drops columns with the available width, so the cards reflow at high zoom; a fixed equal-column template would need collapseBelow.
Flex item vs Grid
PatternUse
Column ratios (2:1, 3:1, ten equal tracks)Grid + GridTemplate
Fixed metric column + two flexible peers on queue boardsQueueMetricsStandard / QueueMetricsEct
Flex row with one scrollable childFlexBox + item={FlexItem.FillScroll}
Cross-axis override on one flex childalignSelf on Box / FlexBox
Before and after
The previews below mirror Grid stories in Storybook.
Default
Columns
Rows
Grid flow
Alignment
Masonry layout
Previous
Grid / Usage
Next
Grid / Accessibility
On this page
Key props
GridTemplate
Subgrid
Form label and field columns
Card rows
Flex item vs Grid
Before and after
Default
Columns
Rows
Grid flow
Alignment
Masonry layout