GridColumns can be used to explicitly place children of a Grid between specified grid lines (the vertical and horizontal lines that make up a Grid).
GridColumn will only work as a direct descendent of a Grid component.
It uses the grid-column
CSS property under the hood. If you want to access the grid-column
property directly, you can use gridColumn
prop; otherwise colStart
and colEnd
are syntactic sugar for the property.
"Grid lines" are not columns, rather they are the grid itself that is created whenever you specify columns
or templateColumns
within a Grid.
You can see these grid lines if you inspect a Grid in your Dev Tools and click the "grid" tag next to your DOM element.
You can specify colStart
and/or colEnd
which represent the grid lines where the column will start and end, respectively, eg: colStart={1} colEnd={3}
which will span 2 columns in the parent Grid. Or you can use gridColumn
which is shorthand for each property separated by a /
, eg: gridColumn="1 / -1"
where -1
is shorthand for the last grid line in the row.
Grid grid lines are 1
indexed, so the last grid line in the row will be numberOfColumns + 1
Full Bleed Columns
You can use GridColumn to create "full bleed" layouts. This is a common layout where most content will not be edge to edge with the parent Grid, rather, content will only occupy columns in the center of the Grid buffered by gutters on either end; some columns may "break" from this and become full bleed spanning the entire width of the layout. You can use GridColumn to accomplish this within the same parent Grid.
A11y
By default GridColumn is not accessibility aware as it renders a standard div
. We highly encourage the use of semantic elements so that screen readers can easily infer intent. This can be achieved through the as
and role
props.