<grid> Component
The <grid>
component arranges its children in a two-dimensional grid layout. It provides control over columns, rows, areas, and spacing between grid items.
<grid>
component arranges its children in a two-dimensional grid layout. It provides control over columns, rows, areas, and spacing between grid items.🛠Attributes
columns
string
No
Number of columns or column sizes (e.g., 3
, 1fr 2fr 1fr
)
rows
string
No
Number of rows or row sizes (e.g., auto
, 100px 1fr
)
gap
string
No
Spacing between grid items (e.g., 16px
)
areas
string
No
Named grid areas (e.g., "header header header" "main main sidebar"
)
align
string
No
Vertical alignment of items (start
, center
, end
, stretch
)
justify
string
No
Horizontal alignment of items (start
, center
, end
, stretch
)
Grid Item Attributes
These attributes can be applied to direct children of <grid>
:
area
string
No
Named grid area to place the item
column
string
No
Column placement (e.g., 1 / 3
, span 2
)
row
string
No
Row placement (e.g., 1 / 3
, span 2
)
✅ Allowed Content
Any valid UDML components or elements.
💡 Examples
Basic Grid
Grid with Areas
Complex Grid Layout
🧩 AI Interpretation Guidelines
Generate a CSS Grid container
Apply specified column and row definitions
Add gap between items if specified
Handle grid area definitions
Apply proper alignment to grid items
Support responsive grid layouts
Maintain proper spacing and alignment in nested structures
Last updated