Responsive Grid
Grid layout patterns using layout-grid and CSS Grid. Responsive by default with no media queries required.
Overview
Vanilla Breeze provides automatic responsive grids through the layout-grid custom element. This snippet includes additional patterns for specific use cases:
- Auto-fit grids - Columns wrap automatically based on available space
- Fixed column grids - Exact column counts with responsive fallbacks
- Asymmetric layouts - Sidebar + content patterns
- Masonry-like layouts - Dense packing for varied-height items
- Named area grids - Dashboard-style complex layouts
Live Demo
Drag the right edge of the demo window to resize and see the grids respond:
layout-grid Element
The simplest way to create responsive grids:
Attributes:
data-gap- Gap size: xs, s, m, l, xl, 2xl (default: m)data-min- Minimum column width (default: 250px)
Common Grid Patterns
Card Grid
Thumbnail Grid
Feature Grid
Fixed Column Grids
When you need exact column counts:
Sidebar Layouts
Asymmetric content + sidebar patterns:
Masonry-Like Layout
Dense packing for items with varied heights:
Gallery Grid
Image gallery with aspect ratio preservation:
Dashboard Grid
Complex layouts with named grid areas:
Related
layout-grid Element
Full documentation for the grid element
layout-sidebar Element
Sidebar layout component
Tokens Starter
Size tokens for grid gaps