Layout Grid Tokens — Column, Gutter, and Container Width Tokens
Define layout grid tokens for column counts, gutter widths, and container max-widths. Create a flexible grid system using CSS custom properties.
Detailed Explanation
Layout Grid as Design Tokens
Layout grids are traditionally defined in CSS frameworks (Bootstrap, Foundation) or Figma auto-layout settings. By expressing grid parameters as design tokens, you create a single source of truth that both designers and developers reference.
Core Grid Tokens
:root {
--layout-columns: 12;
--layout-gutter: 1.5rem;
--layout-margin: 1rem;
--layout-max-width: 1280px;
}
@media (min-width: 768px) {
:root {
--layout-gutter: 2rem;
--layout-margin: 2rem;
}
}
@media (min-width: 1280px) {
:root {
--layout-margin: auto;
}
}
Container Tokens
Define multiple container widths for different content types:
{
"layout": {
"container-sm": "640px",
"container-md": "768px",
"container-lg": "1024px",
"container-xl": "1280px",
"container-2xl": "1536px",
"content-width": "65ch"
}
}
Using Grid Tokens
Apply grid tokens in CSS Grid or Flexbox layouts:
.container {
max-width: var(--layout-max-width);
margin-inline: var(--layout-margin);
padding-inline: var(--layout-gutter);
}
.grid {
display: grid;
grid-template-columns: repeat(var(--layout-columns), 1fr);
gap: var(--layout-gutter);
}
Breakpoint Tokens
Breakpoints themselves can be tokens, though CSS custom properties cannot be used in media query conditions. Store them in your token file for tooling and documentation:
{
"breakpoints": {
"sm": "640px",
"md": "768px",
"lg": "1024px",
"xl": "1280px"
}
}
Use Case
Use layout grid tokens when building responsive layouts that need to stay consistent across a multi-page application, especially when designers and developers need to share the same grid specifications.
Try It — Design Tokens Generator
Related Topics
Spacing Scale System — Consistent Margin and Padding Tokens
Spacing Tokens
Responsive Spacing Tokens — Viewport-Adaptive Spacing Values
Spacing Tokens
Typography Token Scale — Font Size, Weight, and Line Height Tokens
Typography Tokens
Material Design Token System — Complete Color and Spacing Tokens
Color Tokens