Overview
The Grid component provides a powerful and flexible layout system based on CSS Grid. It makes it easy to create responsive, multi-column layouts without manual media queries.Basic Usage
Column Configuration
Fixed Columns
Responsive Columns
Custom Column Widths
Gap Spacing
- Uniform Gap
- Custom Gap
- Row and Column Gap
Grid Item Spans
Control how many columns/rows individual items span:Row Spans
Alignment
Horizontal Alignment
Vertical Alignment
Props
Grid Props
number | object
Number of columns or responsive object:
{ mobile: 1, tablet: 2, desktop: 3 }number
Number of rows
string
Custom grid-template-columns value (e.g.,
"1fr 2fr 1fr")string
default:"md"
Gap between all items:
none, sm, md, lg, xl, or custom valuestring
Gap between rows (overrides
gap for rows)string
Gap between columns (overrides
gap for columns)string
Horizontal alignment:
start, center, end, or stretchstring
Vertical alignment:
start, center, end, or stretchReactNode
required
Grid items
string
Additional CSS class names
GridItem Props
number
Number of columns this item should span
number
Number of rows this item should span
number
Column line where item starts
number
Column line where item ends
number
Row line where item starts
number
Row line where item ends
ReactNode
required
Item content
TypeScript Interfaces
Layout Examples
Card Grid
Dashboard Layout
Holy Grail Layout
For simple column layouts, Grid is often simpler than Flexbox. For single-direction layouts with dynamic sizing, consider using Flexbox instead.
Accessibility
- Uses semantic HTML structure
- Maintains logical reading order for screen readers
- Keyboard navigation works naturally with document flow
- Consider using
orderproperty carefully to avoid disconnecting visual and DOM order