# Page grid

Source: https://ecosphere.dev/docs/layout/page-grid (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

The four column shapes an ERP screen needs, and the section header that separates them.

`import { EcoPageGrid, EcoSection } from "vue-ecosphere"`

## Two-up

Auto-fit grids reflow on their own and need no breakpoint.

Vue (vue-ecosphere):

```vue
<EcoPageGrid layout="2">
  <EcoCard><p class="eyebrow">Enrolment</p><p>916 students across 34 sections.</p></EcoCard>
  <EcoCard><p class="eyebrow">Staff</p><p>68 teaching, 22 support.</p></EcoCard>
</EcoPageGrid>
```

React (react-ecosphere):

```tsx
<EcoPageGrid layout="2">
  <EcoCard><p className="eyebrow">Enrolment</p><p>916 students across 34 sections.</p></EcoCard>
  <EcoCard><p className="eyebrow">Staff</p><p>68 teaching, 22 support.</p></EcoCard>
</EcoPageGrid>
```

## Three-up

Vue (vue-ecosphere):

```vue
<EcoPageGrid layout="3">
  <EcoCard><p class="eyebrow">Classes</p><p>12</p></EcoCard>
  <EcoCard><p class="eyebrow">Sections</p><p>34</p></EcoCard>
  <EcoCard><p class="eyebrow">Rooms</p><p>34</p></EcoCard>
</EcoPageGrid>
```

React (react-ecosphere):

```tsx
<EcoPageGrid layout="3">
  <EcoCard><p className="eyebrow">Classes</p><p>12</p></EcoCard>
  <EcoCard><p className="eyebrow">Sections</p><p>34</p></EcoCard>
  <EcoCard><p className="eyebrow">Rooms</p><p>34</p></EcoCard>
</EcoPageGrid>
```

## Body and a fixed rail

Something edited on the left and summarised on the right. A rail that narrows into a thin column is worse than one that becomes a row underneath, so it stacks.

Vue (vue-ecosphere):

```vue
<EcoPageGrid layout="rail">
  <EcoCard><p class="eyebrow">Body</p><p>The working column: a table, a register, a timetable.</p></EcoCard>
  <EcoCard><p class="eyebrow">Rail</p><p>Summary, activity, whatever is read but not edited.</p></EcoCard>
</EcoPageGrid>
```

React (react-ecosphere):

```tsx
<EcoPageGrid layout="rail">
  <EcoCard><p className="eyebrow">Body</p><p>The working column: a table, a register, a timetable.</p></EcoCard>
  <EcoCard><p className="eyebrow">Rail</p><p>Summary, activity, whatever is read but not edited.</p></EcoCard>
</EcoPageGrid>
```

## Studio

A fixed source list, a fluid middle, a fixed inspector.

Vue (vue-ecosphere):

```vue
<EcoPageGrid layout="studio">
  <EcoCard><p class="eyebrow">Sources</p>…</EcoCard>
  <EcoCard><p class="eyebrow">Paper</p>…</EcoCard>
  <EcoCard><p class="eyebrow">Inspector</p>…</EcoCard>
</EcoPageGrid>
```

React (react-ecosphere):

```tsx
<EcoPageGrid layout="studio">
  <EcoCard><p className="eyebrow">Sources</p>…</EcoCard>
  <EcoCard><p className="eyebrow">Paper</p>…</EcoCard>
  <EcoCard><p className="eyebrow">Inspector</p>…</EcoCard>
</EcoPageGrid>
```

## Section

The section below the fold: a heading with one link or control opposite it.

Vue (vue-ecosphere):

```vue
<EcoSection title="Rooms and capacity">
  <template #action>
    <button class="link" type="button">All 34 rooms <i class="ri-arrow-right-line" aria-hidden="true"></i></button>
  </template>
  <div class="crow">
    <span class="badge badge--success"><span class="badge__dot"></span>28 mapped</span>
    <span class="badge badge--warning"><span class="badge__dot"></span>6 unassigned</span>
    <span class="cline" style="flex: 1; max-width: 260px">
      <span class="bar"><span style="width: 82%"></span></span>
      <span class="num">82%</span>
    </span>
  </div>
</EcoSection>
```

React (react-ecosphere):

```tsx
<EcoSection
  title="Rooms and capacity"
  action={<button className="link" type="button">All 34 rooms <i className="ri-arrow-right-line" aria-hidden="true"></i></button>}
>
  <div className="crow">
    <span className="badge badge--success"><span className="badge__dot"></span>28 mapped</span>
    <span className="badge badge--warning"><span className="badge__dot"></span>6 unassigned</span>
    <span className="cline" style={{ flex: 1, maxWidth: 260 }}>
      <span className="bar"><span style={{ width: "82%" }}></span></span>
      <span className="num">82%</span>
    </span>
  </div>
</EcoSection>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `layout` | `"2" \| "3" \| "rail" \| "studio"` | "2" | cg--2 and cg--3 auto-fit cards; cg--rail is a body beside a fixed --rail-w rail; cg--studio is three panes. All stack at 1240px. |
| `tag` | `string` | "div" | Element to render. |
| `EcoSection title` | `string` | — | Display-face heading at 15px (csec__t); #title slot overrides it. |
| `EcoSection #action` | `slot` | — | One link or control opposite the heading. |
| `EcoSection as / tag` | `string` | "h3" / "section" | Heading level and wrapper element. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `layout` | `"2" \| "3" \| "rail" \| "studio"` | "2" | cg--2 and cg--3 auto-fit cards; cg--rail is a body beside a fixed --rail-w rail; cg--studio is three panes. All stack at 1240px. |
| `tag` | `ElementType` | "div" | Element to render. |
| `EcoSection title` | `ReactNode` | — | Display-face heading at 15px (csec__t): text or a node. |
| `EcoSection action` | `ReactNode` | — | One link or control opposite the heading. |
| `EcoSection as / tag` | `"h2" \| "h3" \| "h4" / ElementType` | "h3" / "section" | Heading level and wrapper element. |
