<kern-grid>
Lays out cards, tiles and form groups in columns. Without columns it fits as many columns of at least min as there is room for, without breakpoints. With columns it has a fixed number of equal columns; columns-sm, columns-md and columns-lg change it from 640, 960 and 1280 px, and kern-grid-item children span several.
Breakpoints are measured on the grid itself (container queries), not on the window, so a grid in a sidebar, a drawer or half a page switches by the room it really has.
Examples
Tiles
Without columns the grid fits as many columns of at least min as there is room for, without breakpoints. Here at least 180 px; resize the window to see it reflow.
Columns and spans
columns sets a fixed number of equal columns; kern-grid-item spans several. span-sm, span-md and span-lg change the span from 640, 960 and 1280 px grid width: here the list and the details are stacked on narrow grids and side by side (8 + 4 of 12) from 960 px.
Columns per width, fit and gap
columns-sm, columns-md and columns-lg change the column count with the grid width; children without kern-grid-item take one column each. In auto mode fit stretches few items over the whole width instead of leaving empty columns. gap is sm (12 px), md (16 px) or lg (24 px); align="start" keeps items at their own height.
Properties
align"start" | "stretch"
stretch makes items in a row equally high (cards); start keeps their own height.
columnsnumber | undefined
Fixed number of columns; switches from auto mode to columns.
columnsLgnumber | undefined
Columns from 1280 px grid width.
columnsMdnumber | undefined
Columns from 960 px grid width.
columnsSmnumber | undefined
Columns from 640 px grid width.
fitboolean
Auto mode: stretch few items over the whole width instead of keeping empty columns.
gap"lg" | "md" | "sm"
Space between items: sm 12 px, md 16 px, lg 24 px.
minstring
Smallest column width in auto mode (without columns), e.g. 240px or 16rem.
Slots
(default)The items: any elements, or kern-grid-item to span columns
CSS parts
gridThe grid