Grid and layout
Every admin screen sits in the same frame: a sidebar, a sticky topbar, and a content area that holds a page head and cards. Marketing pages use the same tokens with a centered container.
The 4 px grid
Section titled “The 4 px grid”All spacing is a multiple of 4 px, from the space scale (see Spacing and radius). Component heights follow it too: controls are 32, 40 and 48 px (--xg-size-control-sm|md|lg), the topbar 64 px, table rows 48 px (36 px compact).
The shell
Section titled “The shell”| Part | Size | Token |
|---|---|---|
| Sidebar | 248 px, collapses to 72 px | --xg-size-sidebar, --xg-size-sidebar-collapsed |
| Topbar | 64 px, sticky, glass | --xg-size-topbar |
| Content padding | 24 px | --xg-space-6 |
| Gap between sections | 24 px | --xg-space-6 |
| Gap between cards | 16 px | --xg-space-4 |
| Card padding | 20 px | --xg-space-5 |
See App shell for the markup.
Content widths
Section titled “Content widths”- Tables and dashboards use the full content width. Tables scroll horizontally inside their card, never the page.
- Forms and settings cap at 1240 px (
--xg-size-container) and keep form columns at about 560 px. - Reading text (help, release notes) caps at 70 characters per line.
- Marketing pages center a 1240 px container with 24 px gutters (18 px on phones).
Breakpoints
Section titled “Breakpoints”| Name | From | What changes |
|---|---|---|
sm |
640 px | Two-column form rows; stepper shows every step name. |
md |
768 px | KPI cards two per row. |
lg |
1024 px | Four KPI cards per row; drawers open beside content. |
xl |
1280 px | Dashboards show two charts side by side. |
Below 900 px the sidebar leaves the layout and opens from the topbar. The product is built for desktop first and must stay usable on a phone: every table scrolls, every dialog fits, nothing needs hover.
Grids inside the content
Section titled “Grids inside the content”Use CSS grid with auto-fit and a minimum column width, not fixed column counts:
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--xg-space-4); }.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--xg-space-4); }The kit ships .xg-kpi-grid for the first case.
The page head
Section titled “The page head”Every page starts the same way: a title (display font, xg-h2), one line of context in muted text, then the controls that scope the whole page (date range, filters) and the page’s primary button on the right. Page actions never go in the topbar.
Layering
Section titled “Layering”Z-index comes only from tokens: dropdown 1000, sticky 1100, overlay 1200, modal 1300, toast 1400, tooltip 1500 (--xg-z-*). A component that needs another layer is a sign it should be a different component.