Agentic Design System
v3.5.0

Foundations · Grid & Layout

Grid & Layout

Spacing defines relationships, radius defines shape - grid defines structure. This is the invisible system that keeps every column, container and breakpoint coherent across the product.

Breakpoints

The actual thresholds this system's own CSS switches on today, not an idealized scale - documented here so a new rule reuses one of these instead of quietly adding a twelfth. A plain CSS custom property can't drive a media-query condition (screen width is evaluated before any variable resolves), so these are reference values to copy literally rather than a token you can point to.

900px The one real structural collapse: sidebar leaves the grid and becomes a slide-in drawer; Project setup's layout stacks to one column max-width
1440 / 1100 / 640px Component-listing grids step down one column at each (4 → 3 → 2 → 1) max-width
640px Topbar padding tightens; version badge and keyboard-shortcut hint hide; Project setup's fields collapse to one column; its action buttons grow to a 44px touch target; Borders/Colors config grids collapse to one column max-width
641-900px Borders page's configuration grid shows 2 columns (the range immediately above the 640px single-column threshold) range
1600px / 1150px Component pages: the Customize inspector widens to 360px at 1600px and above, and narrows to 300px at 1150px and below min-width / max-width
up to 900px Tablet and phone: component pages stack the preview and the Customize panel, the topbar shows 44px icon buttons only, and every page family uses the same gutter (24px from 641px, 16px up to 640px) max-width
900px / 640px Export guide layout (guide-export.css) steps its columns at these two widths max-width
1100px and above Onboarding shows its two-pane layout (onboarding.css and onboarding.js share this threshold) min-width
pointer: coarse Icon buttons and nav links grow to a 44px touch target on touch/coarse-pointer devices, regardless of viewport width capability

What this finding did consolidate: 600px (Project setup's field collapse, several Config-grid collapses) onto the already-common 640px, eliminating one of the real, live stray values. What's left open, disclosed rather than silently dropped: nothing remains open: the later mobile audit moved the former 700, 760, 800 and 1000px thresholds onto the 640 and 900px set, including the component-listing grid's last step (now 640px), so the system has three bands: phone up to 640px, tablet 641 to 900px and desktop from 901px.

What are you building?

Pick the product type closest to yours and the recommended column count and gutter below update to match - every value stays fully editable afterward.

Grid type

Structure defines composition; this decides how content is placed before any spacing or component rules apply.

Layout patterns

Reusable compositions that consume the grid above instead of inventing new structure per screen.

Single Column

Centered content, no structural sidebar - docs, articles, forms.

Content
Two Column

Two balanced content areas side by side.

AB
Sidebar + Content

Persistent navigation alongside the primary content area.

SidebarMain
Dashboard

Header, KPI row and a large chart or table beneath.

HeaderKPIKPIKPIChart
Split View

Two equally-weighted panes, e.g. a live preview beside an editor - a static starting ratio, not a resizable one. The moment a user should be able to drag the divider, this is Splitter's layout, not a plain CSS split: Splitter already enforces sensible minimum sizes on both panes and makes the divider keyboard-operable (arrow keys), so don't reimplement either rule here. Equal weighting is a default, not a rule - when one side's content is reliably more important (e.g. the editor over its own live preview), give it the larger share instead of forcing 50/50. If either pane needs something pinned while its own content scrolls (a toolbar, a header), see Affix's own guidance on accounting for overlap so the pinned element never permanently covers content beneath it.

PreviewEditor
Card Grid

A responsive grid of equal-weight cards.

Hero + Content

A full-bleed hero above a contained content area.

HeroContent
Master-Detail

A scannable list drives which record's full detail shows beside it - email, settings, a record browser. Looks like Sidebar + Content, but the narrow pane is selectable content, not persistent app navigation. If the list pane should be resizable rather than a fixed width, that's Splitter's layout underneath this pattern, with the same minimum-size and keyboard-resize rules as Split View above - not a separate set of rules to invent here.

The diagram alone doesn't define the responsive journey, so here it is: narrow transform - List and Detail never show side-by-side below the 900px structural breakpoint; narrow shows exactly one pane at a time, List by default. Selecting a record replaces the List view with Detail (a drill-down, not both panes stacked - stacking an unbounded list above its own detail doesn't work at phone width). Back is an explicit, visible control in Detail at narrow width (not reliance on the browser's own back button alone, which may not even apply if selection didn't push a history entry) that returns to List with its scroll position and the previously-selected row's highlight both preserved, not a reset to the top. Focus order: selecting a record moves focus to Detail's own heading, not left behind in the list; pressing Back returns focus to that same previously-selected row, not the top of the page - the same restore-to-origin rule, run in both directions. Pane states: Detail before any selection (wide width only, since narrow never shows an empty Detail - there's nothing to select into yet) reads as a real empty state ("Select a record to see its details"), not a blank box; loading state while a selected record's detail is fetched is a skeleton or spinner, not a flash of empty state; an error state offers retry, not a silent blank.

ListDetail

Overflow: reflow first - let the whole page scroll, the normal web default, for anything without a structural reason to be fixed-height: a long form, a settings page, any section that's just "more content than fits." A region only gets its own independent scroll when it has a genuine structural reason to stay a fixed size while its content varies - this shell's own sidebar+main split (both fixed-height, both scroll independently of each other, by design) and bounded data regions like a dashboard KPI row or List's items in Master-Detail (once virtualization is warranted per Table's own paginationAndVirtualization guidance) are the real, named cases, not a blanket rule for every overflow.

A region that does get its own scroll needs: a name (an accessible label identifying what it is, e.g. aria-label="Resource list", not just an anonymous scrollable div), keyboard operability (focusable and Page-Up/Down/arrow-operable - native for a plain overflow region, but verify it if the region also contains its own focusable children), a visible affordance (a real scrollbar or fade/shadow edge - never overflow:auto with nothing hinting there's more), and any fixed action inside it (a toolbar, a "Save" button) staying reachable without first scrolling past unrelated content to find it. Two of these nested inside each other (a scrollable region inside another scrollable region) is close to always wrong - it's the specific anti-pattern a blanket "just scroll it" rule tends to produce.

Two cases the old rule didn't address at all: a virtual keyboard opening on mobile shrinks the viewport - a nested scroll region sized against the viewport's original height can end up clipped behind the keyboard with no way to reach what's now off-screen; reflow (letting the real page scroll) sidesteps this automatically, which is one more reason to prefer it. And truncation (text-overflow ellipsis, a collapsed pane) is only a complete pattern paired with real recovery - an explicit, keyboard-reachable "Show more" control that reveals the rest, not silently-clipped text with no way back to it.

For developers and AI agents: Markdown export and implementation contract

Grid & Layout tokens - Markdown export

A Markdown snapshot of your current product type and grid type choices above - regenerates live as you pick, so it's always in sync. Copy it straight into your design system docs or hand it to an AI/agent workflow.

Implementation contract

Saved validated choices override project recommendations, which override system defaults. This implementation contract governs static specimens. Resolved tokens in the current export are authoritative values. Component exceptions must name the affected role and reason.

Geometry

Columns are integers 1–24; gutters are integers 0–64px. Rows, Columns+Rows and Custom obey the same validation. Baseline is independent. Custom requires explicit geometry; saved geometry is the buildable result, not a preset name.

Platform profiles

The workspace applies one global profile. One selected platform supplies its recommendation; multiple platforms use the product recommendation. Exports also include a light/dark recommendation snapshot for each selected platform, with saved overrides retained. Consumers choose the matching platform profile explicitly; these exports do not automatically implement native layouts or viewport switching. Unsupported context falls back to system defaults and requires review.

Container and spans

Use a centered container capped by --size-content (default 1200px), min-width:0, equal logical gutters and border-box sizing. Main gutters are 40px desktop, 24px compact and 16px below 640px. A span k in N columns is (available width minus (N-1) gutters)/N multiplied by k plus (k-1) gutters. Nested grids use their parent content box, never the full viewport.

Breakpoints and density

640px governs compact reflow and 900px shell navigation. The default 1200px content cap is not a viewport breakpoint. Listing grids retain 1440/1100/640px for their 4→3→2→1 preview sequence; those compatibility thresholds preserve wider 180–220px specimens and their action rows. The component workbench also switches at 1600/1150px (inspector width) and 900px (stack), the export guide at 900/640px and onboarding at 1100px and above. Container thresholds 560/800px govern reference rows; Typography uses 960/640/420px for 3/2/1 control columns. The Border editor's 1000px two-column exception accommodates its six property fields. These content exceptions require boundary/zoom evidence before changes. Density never reduces accessible targets.

Pattern inventory

Single column stacks all content. Split view becomes a labelled drill-down with Back and focus return. Master-detail uses list then detail with loading/empty/error states. Dashboard preserves reading order while stacking cards. Sidebar moves to the navigation drawer. Three-column layouts collapse secondary then tertiary panes. Masonry preserves DOM reading order. Full-screen workspaces keep primary actions reachable and independently name justified scroll regions.

Resize and panes

Splitter panes have explicit min/max bounds, keyboard resizing, Home/End, and persistent user preference scoped to the layout. Collapse never hides the focused action. On wide-to-narrow transitions preserve selection and return focus on Back. Affix content stays below the measured banner and yields when its height exceeds half the viewport.

Overflow and handoff

Reflow first. Confine unavoidable tables/code to named keyboard-operable scroll regions. Avoid page-wide horizontal scroll. Show truncation recovery. Export container, columns, gutter, spans, baseline, thresholds, pattern states and resize/overflow rules.

Pattern: Single Column

Use one readable content column within the shared maximum container. At narrow widths keep source order, equal gutters and reachable primary actions. Empty content states explain why and offer the next action; loading reserves the expected structure; error offers retry without losing entries.

Pattern: Two Column

Use two related columns at wide widths. Below 900px stack in source order rather than CSS visual reordering. Each column may show its own named empty/loading/error state. Keep keyboard focus in the edited column across reflow; do not shrink form labels or fields to fit.

Pattern: Sidebar + Content

Use persistent navigation beside the main pane above 900px. At 900px and below use a named navigation drawer with a trigger, Escape dismissal and focus restoration. Selection updates the active navigation item; loading/error belongs to main content, not the whole navigation tree.

Pattern: Dashboard

Header precedes KPI cards and then charts/tables in source order. Cards wrap with minmax and a minimum readable width rather than a fixed card count. Preserve independent loading/error states per region and expose exact values for abbreviated metrics. Bounded wide tables scroll in a named keyboard-operable region.

Pattern: Split View

Wide uses two panes with an explicit content-priority ratio. Narrow stacks editor then preview in source order; preserve entered data and the current focus. Resizing uses the shared Splitter controller with arrow keys, Shift/Home/End, collapse/restore, pointer cancellation and versioned ratios. A static split has no fake interactive handle.

Pattern: Card Grid

Equal-weight cards use auto-fit with a documented minimum readable width. Narrow reflows to one column; keep DOM reading order. Clickable cards expose one named link or action. Static cards do not gain hover elevation. Empty/loading/error states occupy the collection region and retain filter values.

Pattern: Hero + Content

A hero may span the container but its text and actions keep the same safe content gutters as the body. At narrow widths wrap text, contain imagery and keep primary actions visible. Do not use a fixed height that clips expansion, zoom or a long translated title. Decorative imagery has empty alternative text.

Pattern: Master-Detail

Above 900px keep list and detail side by side; before selection show a real detail empty state. At 900px and below display only list or detail. Selecting moves focus to the detail heading; Back restores the selected row and list scroll. Loading retains selection and aria-busy; error offers Retry for the same record. Clear selection restores the originating list focus. The Try Master-Detail specimen exercises this local journey.

Save and edit

Selections preview immediately. Save foundation commits valid settings in this browser and locks the editor. Select Edit foundation to revise saved settings; Cancel retains the saved settings. Storage failure keeps the draft editable.

Machine contract: section rules, storage, units and acceptance
{
  "schemaVersion": 1,
  "authority": "Saved validated choices override project recommendations, which override system defaults. This implementation contract governs static specimens. Resolved tokens in the current export are authoritative values. Component exceptions must name the affected role and reason.",
  "governance": {
    "owners": "Design System Lead owns token and compatibility policy. Designers own specimens and interaction contracts. Developers own resolver/export/import parity. QA and Accessibility own release evidence. Product teams own domain-specific confidence, privacy and retention policies.",
    "changes": "Change the JSON contract first, regenerate documentation/defaults/catalog/tokens, then run model, DOM and recipient checks. Link the changed finding IDs and evidence in the release review.",
    "compatibility": "Keep hue-named CSS tokens as compatibility aliases while semantic consumers migrate. Additive tokens retain schemaVersion 1. A removed/renamed key or changed stored meaning requires a schema migration, a version bump and a documented replacement before release. Keep the prior reader fixture until the migration is verified.",
    "deprecation": "Record old key, replacement, reason, introduced version, planned removal version and affected consumers. Do not remove a token while an active consumer still uses it. Future records are preserved rather than coerced.",
    "scope": "This is a web design system with one shared workspace profile. Native dp/sp adaptation and real agent execution require separate adapters and acceptance. User-defined colors and responsive exceptions require product-specific rendered verification."
  },
  "storage": {
    "version": 1,
    "legacy": "Unversioned valid records migrate in memory. Typography headingScaleVersion 2 applies the smaller six-heading scale once to older records, retaining other roles and existing font/color/style metrics. Later custom size edits are retained. Unsupported future records are preserved. The next successful write stamps the migrated version.",
    "future": "Reject unsupported future versions. Preserve raw data. Offer backup and explicit reset.",
    "invalid": "Foundation selections preview locally until Save foundation succeeds. Saved Foundation editors require Edit foundation before changes. Cancel discards the preview. Invalid drafts never replace saved records; storage failures retain the editable preview and the last durable record.",
    "concurrency": "A storage event refreshes applied tokens and disables stale editor controls until reload. Never merge simultaneous edits silently."
  },
  "units": {
    "base": "1rem = 16px at default browser settings. Do not fix the root font size.",
    "use": "Prefer rem for typography, spacing and control dimensions. Hairline borders and viewport thresholds may use px. Both equivalents appear in Markdown. SVG strokes use viewBox units. Ratios, percentages, columns, timing and weights are unitless or retain their own units.",
    "native": "Web CSS px/rem are not native dp/sp. A native adapter must map semantic roles, support text scaling and test device density. Native rendering is not shipped by this web library."
  },
  "acceptance": [
    "Compare page, applied tokens, durable record, Machine View and exported instructions.",
    "Test valid, unfinished, invalid, missing, malformed, legacy and future records. Exercise storage failure, reset, reload and another tab.",
    "Test 320, 375, 768, 1024 and 1440px widths, 200% zoom, text-spacing overrides, RTL and long/localized labels.",
    "Use keyboard and screen reader. Confirm focus return, names, values, error associations and status announcements.",
    "Verify actual rendered text/surface pairs, forced colors, reduced motion, print and exported recipes in a recipient fixture. Source or DOM checks alone are not rendered acceptance."
  ],
  "layers": {
    "content": 0,
    "sticky": 20,
    "popover": 40,
    "scrim": 60,
    "dialog": 70,
    "toast": 80,
    "tooltip": 90,
    "rules": "Each overlay gets an explicit owner and close/focus-return path. Portal menus out of clipped scroll containers. Nested dialogs stack one scrim per modal owner. Escape closes the top dismissible layer. Tooltips never block actions. Test collision and zoom; do not infer stacking order from shadow size."
  },
  "section": {
    "title": "Grid & Layout",
    "rules": {
      "Geometry": "Columns are integers 1\u201324; gutters are integers 0\u201364px. Rows, Columns+Rows and Custom obey the same validation. Baseline is independent. Custom requires explicit geometry; saved geometry is the buildable result, not a preset name.",
      "Platform profiles": "The workspace applies one global profile. One selected platform supplies its recommendation; multiple platforms use the product recommendation. Exports also include a light/dark recommendation snapshot for each selected platform, with saved overrides retained. Consumers choose the matching platform profile explicitly; these exports do not automatically implement native layouts or viewport switching. Unsupported context falls back to system defaults and requires review.",
      "Container and spans": "Use a centered container capped by --size-content (default 1200px), min-width:0, equal logical gutters and border-box sizing. Main gutters are 40px desktop, 24px compact and 16px below 640px. A span k in N columns is (available width minus (N-1) gutters)/N multiplied by k plus (k-1) gutters. Nested grids use their parent content box, never the full viewport.",
      "Breakpoints and density": "640px governs compact reflow and 900px shell navigation. The default 1200px content cap is not a viewport breakpoint. Listing grids retain 1440/1100/640px for their 4\u21923\u21922\u21921 preview sequence; those compatibility thresholds preserve wider 180\u2013220px specimens and their action rows. The component workbench also switches at 1600/1150px (inspector width) and 900px (stack), the export guide at 900/640px and onboarding at 1100px and above. Container thresholds 560/800px govern reference rows; Typography uses 960/640/420px for 3/2/1 control columns. The Border editor's 1000px two-column exception accommodates its six property fields. These content exceptions require boundary/zoom evidence before changes. Density never reduces accessible targets.",
      "Pattern inventory": "Single column stacks all content. Split view becomes a labelled drill-down with Back and focus return. Master-detail uses list then detail with loading/empty/error states. Dashboard preserves reading order while stacking cards. Sidebar moves to the navigation drawer. Three-column layouts collapse secondary then tertiary panes. Masonry preserves DOM reading order. Full-screen workspaces keep primary actions reachable and independently name justified scroll regions.",
      "Resize and panes": "Splitter panes have explicit min/max bounds, keyboard resizing, Home/End, and persistent user preference scoped to the layout. Collapse never hides the focused action. On wide-to-narrow transitions preserve selection and return focus on Back. Affix content stays below the measured banner and yields when its height exceeds half the viewport.",
      "Overflow and handoff": "Reflow first. Confine unavoidable tables/code to named keyboard-operable scroll regions. Avoid page-wide horizontal scroll. Show truncation recovery. Export container, columns, gutter, spans, baseline, thresholds, pattern states and resize/overflow rules.",
      "Pattern: Single Column": "Use one readable content column within the shared maximum container. At narrow widths keep source order, equal gutters and reachable primary actions. Empty content states explain why and offer the next action; loading reserves the expected structure; error offers retry without losing entries.",
      "Pattern: Two Column": "Use two related columns at wide widths. Below 900px stack in source order rather than CSS visual reordering. Each column may show its own named empty/loading/error state. Keep keyboard focus in the edited column across reflow; do not shrink form labels or fields to fit.",
      "Pattern: Sidebar + Content": "Use persistent navigation beside the main pane above 900px. At 900px and below use a named navigation drawer with a trigger, Escape dismissal and focus restoration. Selection updates the active navigation item; loading/error belongs to main content, not the whole navigation tree.",
      "Pattern: Dashboard": "Header precedes KPI cards and then charts/tables in source order. Cards wrap with minmax and a minimum readable width rather than a fixed card count. Preserve independent loading/error states per region and expose exact values for abbreviated metrics. Bounded wide tables scroll in a named keyboard-operable region.",
      "Pattern: Split View": "Wide uses two panes with an explicit content-priority ratio. Narrow stacks editor then preview in source order; preserve entered data and the current focus. Resizing uses the shared Splitter controller with arrow keys, Shift/Home/End, collapse/restore, pointer cancellation and versioned ratios. A static split has no fake interactive handle.",
      "Pattern: Card Grid": "Equal-weight cards use auto-fit with a documented minimum readable width. Narrow reflows to one column; keep DOM reading order. Clickable cards expose one named link or action. Static cards do not gain hover elevation. Empty/loading/error states occupy the collection region and retain filter values.",
      "Pattern: Hero + Content": "A hero may span the container but its text and actions keep the same safe content gutters as the body. At narrow widths wrap text, contain imagery and keep primary actions visible. Do not use a fixed height that clips expansion, zoom or a long translated title. Decorative imagery has empty alternative text.",
      "Pattern: Master-Detail": "Above 900px keep list and detail side by side; before selection show a real detail empty state. At 900px and below display only list or detail. Selecting moves focus to the detail heading; Back restores the selected row and list scroll. Loading retains selection and aria-busy; error offers Retry for the same record. Clear selection restores the originating list focus. The Try Master-Detail specimen exercises this local journey.",
      "Save and edit": "Selections preview immediately. Save foundation commits valid settings in this browser and locks the editor. Select Edit foundation to revise saved settings; Cancel retains the saved settings. Storage failure keeps the draft editable."
    }
  }
}