SimpleGrid
Responsive grid where each item takes equal amount of space
Import
Source
Docs
Package
Usage
SimpleGrid is a simple flexbox container where each child is treated as a column. Each column takes equal amount of space and unlike Grid component you do not control column span, instead you specify number of columns per row:
1
2
3
4
5
Spacing
xs
sm
md
lg
xl
Breakpoints
Provide an array to breakpoints
prop to define responsive behavior:
maxWidth
orminWidth
– max-width or min-width at which media query will workcols
– number of columns per row at given max-widthspacing
– optional spacing at given max-width, if not provided spacing from component prop will be used instead
Resize browser to see breakpoints behavior:
1
2
3
4
5
In this example:
- If screen width is more than 980px then component
cols
andspacing
is used – 4 columns, lg spacing - screen width < 980px and > 755px – cols = 3, spacing = sm
- screen width < 755px and > 680px – cols = 2, spacing = sm
- screen width < 680px – cols = 1, spacing = sm
You can also use breakpoints from theme to set maxWidth
:
1
2
3
4
5
min-width breakpoints
If you prefer a mobile first approach, you can use min-width breakpoints:
Spacing
You can use either theme.spacing
value or number value for spacing in px:
Spacing also works in breakpoints
:
Browser support
Simple grid uses CSS Grid Layout, check caniuse to find out information about browser support.
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback