Basic Usage
Props
Number of columns in the grid. The grid automatically adjusts for smaller screen sizes:
- 1 column: Always single column
- 2 columns: 1 column on mobile, 2 on tablet and up
- 3 columns: 1 column on mobile, 2 on tablet, 3 on desktop
- 4 columns: 1 column on mobile, 2 on tablet, 3 on medium desktop, 4 on large
- 5 columns: 1 column on mobile, 2 on tablet, 3 on medium desktop, 5 on large
- 6 columns: 1 column on mobile, 2 on tablet, 3 on medium desktop, 6 on large
Controls the spacing between grid items:
- none: 0px gap
- sm: 8px gap
- md: 16px gap
- lg: 32px gap
Examples
Two Column Grid
Four Column Dashboard
Chart Grid
No Gap Grid
Responsive Behavior
The Grid component is designed to be fully responsive. Breakpoints are automatically applied based on thecols prop:
- Mobile (< 640px): Displays 1 column for all grid configurations
- Tablet (640px - 767px): Displays 2 columns for grids with
cols>= 2 - Desktop (768px - 1023px): Displays 3 columns for grids with
cols>= 3 - Large Desktop (>= 1024px): Displays the full number of columns specified in
cols
Use Cases
- Dashboard metrics: Display KPIs in a clean, scannable grid
- Chart galleries: Organize multiple visualizations side by side
- Feature cards: Showcase product features or benefits
- Image galleries: Create photo or media grids
- Report sections: Structure different report sections in columns
Notes
- The Grid component uses CSS Grid under the hood
- Grid items will stretch to fill available space
- Gap sizes are defined in pixels and remain consistent across screen sizes
- The component sets a context that child charts can use to calculate appropriate widths for printing