Layout grid and spacing

From Legal-and-General/canopy · View interactive version

Layout grid and spacing is an AI agent skill from the GitHub repository Legal-and-General/canopy. Foundation guidance for Canopy layout, responsive grid, and spacing. Trigger when setting up responsive layouts, choosing breakpoints, or understanding the grid and spacing system in an Angular project using Canopy.

How to use this skill

Skill file

Canopy Layout, Grid and Spacing — Foundation

This skill provides guidance on the Canopy responsive layout grid and spacing system.

Apply this skill when setting up page layouts, choosing breakpoints, or applying spacing variables.

See also: the grid skill for Angular grid directives (lgContainer, lgRow, lgCol), and spacing-margin, spacing-padding, and spacing-row-gap for directive-based spacing.


Breakpoints

Five mobile-first breakpoints are available:

| Breakpoint | Min-width | Max-width | Margin | Gutter |

|------------|-----------|-----------|--------|--------|

| SM | 0 | 767px | 16px | 28px |

| MD | 768px | 1023px | 28px | 28px |

| LG | 1024px | 1279px | 32px | 32px |

| XL | 1280px | 1439px | 72px | 32px |

| XXL | 1440px | No max | 104px | 32px |

Always design mobile-first. Start with the smallest size (360px, ensure reflow at 320px).


Grid

The grid is based on flexbox. Import the Canopy global CSS to use it.

<div lgContainer>
  <div lgRow>
    <div [lgCol]="12" [lgColMd]="6">Left</div>
    <div [lgCol]="12" [lgColMd]="6">Right</div>
  </div>
</div>

Use the grid sparingly. For many layouts, plain flexbox is sufficient.


Spacing Variables

The spacing system uses CSS custom properties. Variables are responsive — they change between SM-MD and LG+ breakpoints.

Key spacing variables used in components:

| Variable | SM–MD | LG+ |

|----------|-------|-----|

| --component-padding | var(--space-1) | var(--space-6) |

| --component-margin | var(--space-5) | var(--space-6) |

Use liberal vertical spacing — whitespace aids comprehension and visual rhythm.


Related Directives

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.