Skip to Content
BBRICKSv0.7.4
KitPatterns

PageGrid

The PR Portal mock's page grid (.grid, 16px gaps): a split of 8 / 4, 7 / 5 or 6 / 6 on 12 columns, cols of 2, 3 or 4 equal columns, or a single-column stack. It collapses at the mock's page widths (1180px for splits and two columns, 1100px for three and four) unless collapse={false}; align="start" keeps each cell's own height, and stickyAside pins a split's side column while the page scrolls. Any other div attribute (an id, an aria-label) goes on the grid.

import { PageGrid } from '@ergasti/bricks';

Examples

Main and side columns

split="8-4" puts the main card on 8 of 12 columns and the side column on 4, 16px apart; align="start" lets each keep its own height. It is one column at 1180px and under.

Code
import { Card, PageGrid } from '@ergasti/bricks';

function Split() {
  return (
    <PageGrid split="8-4" align="start">
      <Card title="Needs attention" sub="Join requests and reviews"><p style={{ margin: 0 }}>4 join requests, 5 to review.</p></Card>
      <PageGrid align="start">
        <Card title="My brands"><p style={{ margin: 0 }}>Glow Lab, Nile Threads</p></Card>
        <Card title="Live challenges"><p style={{ margin: 0 }}>Winter top 10</p></Card>
      </PageGrid>
    </PageGrid>
  );
}

A row of stats

cols={4} draws four equal columns, two at 1100px and under; cols={3} and cols={2} work the same way.

Code
import { PageGrid, Tile } from '@ergasti/bricks';

function Columns() {
  return (
    <PageGrid cols={4}>
      <Tile size="stat" tone="rasp" label="Joined" value="64" />
      <Tile size="stat" tone="lime" label="Goal" value="Top 10 by delivered sales" valueSize="sm" />
      <Tile size="stat" tone="sky" label="Reward" value="EGP 1,000 each" valueSize="sm" />
      <Tile size="stat" tone="lilac" label="Days left" value="15" />
    </PageGrid>
  );
}

A sticky summary

stickyAside keeps the side column in view while a long main column scrolls (the challenge builder's summary), above 1180px.

Code (not run)
import { Card, PageGrid } from '@ergasti/bricks';

function StickyAside() {
  return (
    <PageGrid split="8-4" stickyAside>
      <Card title="Basics"><div style={{ height: 600 }}>The step's fields.</div></Card>
      <Card title="Summary"><p style={{ margin: 0 }}>Budget to hold: EGP 10,000</p></Card>
    </PageGrid>
  );
}

Arabic

The main column sits on the right; nothing else changes.

Pinned to Arabic
Code
import { Card, PageGrid } from '@ergasti/bricks';

function Arabic() {
  return (
    <PageGrid split="7-5">
      <Card title="طلبات التغيير"><p style={{ margin: 0 }}>طلب واحد مستني</p></Card>
      <Card title="الحملة الجاية"><p style={{ margin: 0 }}>Spring glow 2027</p></Card>
    </PageGrid>
  );
}

Props

Prop

Type

Also accepts the react and dom attributes of the element it renders; they are passed through.

Design guidance

How the BRICKS design system uses PageGrid. Written in docs/content/components/PageGrid.md; the props above are read from the code, which wins where the two disagree.

The PR Portal page grid, 16px gaps: an 8 / 4, 7 / 5 or 6 / 6 split on 12 columns, two to four equal columns, or a single-column stack; use it for every row of cards on a page instead of a screen's own grid CSS.

It is the PR v3 mock's .grid (display: grid; gap: 16px) with .c12 and the .s8 / .s4, .s7 / .s5, .s6 / .s6 spans, plus the mock's .sticky side column. Before 0.7 each screen wrote its own (.scr-grid, .ppl-grid--84, inline gridTemplateColumns), each with its own breakpoints; PageGrid puts the mock's collapse widths in one place (1180px for splits and two columns, 1100px for three and four). Any other div attribute (an id, an aria-label) goes on the grid.

Anatomy

  1. Grid: <div class="kit-pgrid">, display: grid; gap: 16px.
  2. Layout class: kit-pgrid--8-4 / --7-5 / --6-6 (12 columns; in 8-4 and 7-5 odd children take the main span and even children the side span, in 6-6 each child takes 6) or kit-pgrid--c2 / --c3 / --c4 (equal columns). Neither: a one-column stack.
  3. Modifiers: kit-pgrid--start (align="start"), kit-pgrid--keep (collapse={false}), kit-pgrid--sticky (stickyAside).
  4. Children: cards, tiles, or a nested PageGrid stack as a column.

Variants

Prop valueLookWhen to use
split="8-4"Main 8 of 12, side 4A long main card with side cards: Home's "Needs you" / My brands, Brand detail, Brand request, a gift claim, the challenge builder.
split="7-5"7 / 5A brand's campaign (change requests / next campaign; the commission form / preview and status); Gift analytics' Needs attention / Shipments from brands.
split="6-6"Two halves on 12 columnsTwo equal cards where the mock writes .s6 / .s6.
cols={4}Four equal; two at 1100px and underThe stat and KPI rows (Brand detail, a challenge, Challenges, Creators, View as brand). Gift stock's shipment row is a KpiGrid.
cols={3}Three; one at 1100px and underHome's three queue tiles.
cols={2}Two; one at 1180px and underTiers' two cards of mini rows.
no split / colsOne column, 16px apartA side column inside a split; a stack of cards.
align="stretch" (default)Cells in a row share its heightRows of tiles or cards that should line up.
align="start"Each cell keeps its height; rows sit at the topA side column of short cards beside a long main card.
collapse={false}Columns at every widthTwo date fields side by side in a form; two stats in a drawer.
stickyAsideWith split, the last child sticks 20px under the top above 1180pxThe challenge builder's summary beside the step.

split wins over cols when both are given.

States

StateHow
WideColumns as set.
≤1180pxSplits and cols={2} become one column (unless collapse={false}); stickyAside stops sticking.
≤1100pxcols={4} becomes two, cols={3} one (unless collapse={false}).
Sticky offset--sticky-aside-top on an ancestor changes the 20px (under a sticky header).

Usage

// PR Portal › Affiliate programs › Challenges › Brand request: the request card beside a stack of side cards
import { BrandRequestCard, PageGrid, RequestGiftsCard, RequestWalletCard } from '@ergasti/bricks';

export function RequestBody({ approve, reject }: { approve: () => void; reject: () => void }) {
  return (
    <PageGrid split="8-4" align="start">
      <BrandRequestCard dates="1–31 Dec" budget="15000.00" reward="Cash"
        message="We want to push our winter line before New Year. Happy to go up to 15,000."
        money={{ decimals: 'auto' }} onApprove={approve} onReject={reject} />
      <PageGrid align="start">
        <RequestWalletCard brandName="Nile Threads" health="ok" available="22000.00" requested="15000.00" money={{ decimals: 'auto' }} />
        <RequestGiftsCard claims={[{ id: 'GS-0015', claimed: 25, status: 'gift_expected' }]} onOpen={() => {}} />
      </PageGrid>
    </PageGrid>
  );
}
// PR Portal › Affiliate programs › Challenges › a challenge: the four stat tiles
import { PageGrid, Tile } from '@ergasti/bricks';

export function ChallengeStats() {
  return (
    <PageGrid cols={4} align="start">
      <Tile size="stat" tone="rasp" label="Joined" value="64" />
      <Tile size="stat" tone="lime" label="Goal" value="Top 10 by delivered sales" valueSize="sm" />
      <Tile size="stat" tone="sky" label="Reward" value="EGP 1,000 each" valueSize="sm" />
      <Tile size="stat" tone="lilac" label="Days left" value="15" />
    </PageGrid>
  );
}
// PR Portal › Affiliate programs › Challenges › builder: the step scrolls, the summary stays in view
import { Card, PageGrid } from '@ergasti/bricks';

export function BuilderLayout({ step, summary }: { step: React.ReactNode; summary: React.ReactNode }) {
  return (
    <PageGrid split="8-4" align="start" stickyAside>
      <Card title="Basics">{step}</Card>
      {summary}
    </PageGrid>
  );
}
// Two date fields that never stack
import { FormField, PageGrid } from '@ergasti/bricks';

export function Dates({ from, to, setFrom, setTo }: { from: string; to: string; setFrom: (v: string) => void; setTo: (v: string) => void }) {
  return (
    <PageGrid cols={2} collapse={false}>
      <FormField label="Starts"><input type="date" value={from} onChange={(e) => setFrom(e.target.value)} /></FormField>
      <FormField label="Ends"><input type="date" value={to} onChange={(e) => setTo(e.target.value)} /></FormField>
    </PageGrid>
  );
}

Where it appears

Guidelines

Do

  • Put children in main, side, main, side order for a split; wrap a column of several cards in a nested PageGrid (no layout prop).
  • Use align="start" whenever the side column is shorter than the main card.
  • Keep the page's vertical rhythm with the grid's 16px gap; put a SectionHeading between two grids for a titled group.

Don't

  • Don't write a screen-level grid class or inline gridTemplateColumns for these layouts.
  • Don't put more than two children per row in a split; a third child starts a new row.
  • Don't use stickyAside when the side column is taller than the viewport.
  • Don't use it for the Brand dashboard's fixed KPI row; that is KpiGrid (or StatGrid for other counts).

RTL and Arabic

  • Grid columns follow the direction: the main column is on the right in Arabic; nothing else changes.

Tokens

--sticky-aside-top (default 20px). Gap and breakpoints are fixed in CSS (16px; 1180px, 1100px).

Accessibility

  • A plain <div> with no role; reading and tab order follow the source order (main, then side), which is also the one-column order.
  • Pass aria-label or aria-labelledby only if you also give it a landmark role; otherwise leave naming to the cards' headings.

Found in the source

  • No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Accordion · HeroCard · KeyValue

Source

src/kit/patterns/PageGrid.tsx (line 41) on GitHub.

On this page