The Grid layout provides complete control by leveraging CSS Grid. It is recommended for complex layouts or when you need variable-sized columns.
Layout Configuration (Container):
Accepts any CSS Grid Container property starting with grid-, as well as grid, place-items, and place-content. It also supports margin, padding, and height.
Card Configuration (Items):
Accepts any CSS Grid Item property starting with grid-, as well as place-self via the view_layout key.
Responsive Design:
Use the mediaquery option within the layout configuration to define different grid settings for different screen sizes. Only the first matching rule is applied.
Example Configuration:
type: custom:grid-layout
layout:
grid-template-columns: auto 30px 25%
grid-template-rows: auto
grid-template-areas: |
"header header header"
"main . sidebar"
"footer footer footer"
mediaquery:
"(max-width: 600px)":
grid-template-columns: 100%
grid-template-areas: |
"header"
"sidebar"
"main"
"footer"
"(max-width: 800px)":
grid-template-columns: 50% 50%
grid-template-areas: |
"header sidebar"
"main main"
"footer footer"
cards:
- type: entities
view_layout:
grid-area: header
- type: entities
view_layout:
grid-area: footer
- type: entities
view_layout:
grid-area: sidebar
- type: entities
view_layout:
grid-area: main