Grid
Flexible CSS Grid layout with monospace-aligned character-width spacing.
Import
Usage
The Grid component uses CSS Grid with character-width (ch) based gaps for proper TUI alignment.
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Props
Grid
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Grid content (typically GridItem elements) |
| columns | number | 'auto' | 'auto' | Number of columns, or 'auto' for auto-fit responsive columns |
| gap | number | 2 | Gap between items in ch units |
| rowGap | number | - | Gap between rows in ch units (overrides gap) |
| columnGap | number | - | Gap between columns in ch units (overrides gap) |
| className | string | - | Additional CSS class name |
GridItem
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Grid item content |
| span | number | - | Number of columns to span |
| className | string | - | Additional CSS class name |
Variants
Basic
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
With Spanning
Span 2
Normal
Normal
Normal
Span 3
Full Width (Span 4)
Auto-fit Responsive
Auto 1
Auto 2
Auto 3
Auto 4
Auto 5
Custom Row/Column Gaps
Row gap: 4ch
Column gap: 8ch
Different gaps
For layout