Ctrl + k
Theme:

Grid

Grid is used to create a responsive grid system.

col property is used to set the column size.

Column
Column
Column

Utilize breakpoint-specific column props for easy column sizing without an explicit numbered like colSm="6".

For example, here are two grid layouts that apply to every device and viewport, from xs to xxl. Add any number of unit-less col for each breakpoint you need and every column will be the same width.

1 of 2
2 of 2
1 of 3
2 of 3
3 of 3

Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it. Note that the other columns will resize no matter the width of the center column.

1 of 3
2 of 3 (wider)
3 of 3
1 of 3
2 of 3 (wider)
3 of 3

Use colXs="auto", colSm="auto", colMd="auto", colLg="auto", colXl="auto", or colXxl="auto" classes to size columns based on the natural width of their content.

1 of 3
Variable width content
3 of 3
1 of 3
Variable width content
3 of 3

For grids that are the same from the smallest of devices to the largest, use the col and col="1~12" . Specify a numbered prop when you need a particularly sized column; otherwise, feel free to stick to col.

col
col
col
col
col="8"
col="4"

Using a single set colSm="1~12", you can create a basic grid system that starts out stacked and becomes horizontal at the small breakpoint (sm).

colSm="8"
colSm="4"
colSm
colSm
colSm

Use a combination of different col prop for each tier as needed. See the example below for a better idea of how it all works.

colMd="8"
col="6" colMd="4"
col="6" colMd="4"
col="6" colMd="4"
col="6" colMd="4"
col="6"
col="6"

Use the responsive rowCols properties to quickly set the number of columns that best render your content and layout. Whereas normal col="1~12" classes apply to the individual columns (e.g., colmd="4"), the row columns classes are set on the parent row as a shortcut. With rowCols="auto" you can give the columns their natural width. Use these row columns classes to quickly create basic grid layouts or to control your card layouts.

Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
Column
col="6"
Column
Column
Column
Column
Column

To nest your content with the default grid, add a new row and set of colSm="1~12" columns within an existing colSm="1~12" column. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).

Level 1: colSm="3"
Level 2: col="8" colSm="6"
Level 2: col="4" colSm="6"
© 2024 YeSvelte. All Rights Reserved