# App shell

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

Fixed sidebar, floating glass topbar and work area: the frame every Ecosphere screen sits in.

`import { EcoAppShell, EcoNavItem, EcoNavSection } from "vue-ecosphere"`

## App shell

The brand lockup is type: an accent tile with one letter, then the product name with its qualifier muted. The rail is a layout state on body (data-rail), so one page has one rail: this demo stays expanded, and the button at the foot of this site's own sidebar shows the rail. Below 1024px the sidebar becomes a drawer behind the burger.

Vue (vue-ecosphere):

```vue
<EcoAppShell v-model:rail="rail" brand="Ecosphere" brand-suffix="Campus" where="Requests">
  <template #nav>
    <EcoNavSection>Overview</EcoNavSection>
    <EcoNavItem icon="layout-grid-line" label="Dashboard" to="/dashboard" />
    <EcoNavItem icon="search-line" label="Search" to="/search" />
    <EcoNavItem icon="contacts-book-line" label="Saved items" to="/saved" />
    <EcoNavSection>Work</EcoNavSection>
    <EcoNavItem icon="table-line" label="Activity" to="/activity" />
    <EcoNavItem icon="mail-line" label="Requests" to="/requests" :count="4" />
  </template>

  <template #topbar-end>
    <button class="iconbtn" type="button" data-tip="Notifications" aria-label="Notifications">
      <i class="ri-notification-3-line" aria-hidden="true"></i>
      <span class="iconbtn__dot" aria-hidden="true"></span>
    </button>
    <button class="avatar avatar--sm" type="button" aria-label="Account, Alex Jordan">AJ</button>
  </template>

  <!-- default slot: the work area -->
  <RouterView />
</EcoAppShell>
```

React (react-ecosphere):

```tsx
// Link and Outlet from react-router
<EcoAppShell
  rail={rail}
  onRailChange={setRail}
  brand="Ecosphere"
  brandSuffix="Campus"
  where="Requests"
  nav={
    <>
      <EcoNavSection>Overview</EcoNavSection>
      <EcoNavItem as={Link} to="/dashboard" icon="layout-grid-line" label="Dashboard" />
      <EcoNavItem as={Link} to="/search" icon="search-line" label="Search" />
      <EcoNavItem as={Link} to="/saved" icon="contacts-book-line" label="Saved items" />
      <EcoNavSection>Work</EcoNavSection>
      <EcoNavItem as={Link} to="/activity" icon="table-line" label="Activity" />
      <EcoNavItem as={Link} to="/requests" icon="mail-line" label="Requests" count={4} active />
    </>
  }
  topbarEnd={
    <>
      <button className="iconbtn" type="button" data-tip="Notifications" aria-label="Notifications">
        <i className="ri-notification-3-line" aria-hidden="true"></i>
        <span className="iconbtn__dot" aria-hidden="true"></span>
      </button>
      <button className="avatar avatar--sm" type="button" aria-label="Account, Alex Jordan">AJ</button>
    </>
  }
>
  {/* children: the work area */}
  <Outlet />
</EcoAppShell>
```

## Topbar styles

Inset is the default and the recommended topbar. Inset and island stay transparent at rest and lift into frosted glass as the work area scrolls, with a lit hairline in place of a shadow; auto-hide slides the bar away while you read down and brings it back as soon as you scroll up. None drops the topbar and puts the user beside the sidebar's collapse button. Use auto-hide on the pages that need the room, such as long reading or long forms, rather than everywhere. Scroll inside the frame.

Vue (vue-ecosphere):

```vue
<!-- inset (default, recommended) | island | static | none -->
<!-- auto-hide only where a page needs the room: here, routes with meta.autoHide -->
<EcoAppShell topbar-style="inset" :topbar-auto-hide="!!route.meta.autoHide" where="Requests">
  <template #nav>…</template>
  <template #topbar-end>
    <button class="iconbtn" type="button" aria-label="Notifications"><i class="ri-notification-3-line"></i></button>
  </template>
  <!-- the signed-in user: end of the topbar, or the sidebar foot with topbar-style="none" -->
  <template #user>
    <button class="avatar avatar--sm" type="button" aria-label="Account, Alex Jordan">AJ</button>
  </template>
  <RouterView />
</EcoAppShell>
```

React (react-ecosphere):

```tsx
{/* "inset" (default, recommended) | "island" | "static" | "none" */}
{/* auto-hide only where a page needs the room: here, routes whose handle asks for it */}
<EcoAppShell
  topbarStyle="inset"
  topbarAutoHide={matches.some((m) => m.handle?.autoHide)}
  where="Requests"
  nav={…}
  topbarEnd={<button className="iconbtn" type="button" aria-label="Notifications"><i className="ri-notification-3-line"></i></button>}
  user={<button className="avatar avatar--sm" type="button" aria-label="Account, Alex Jordan">AJ</button>}
>
  <Outlet />
</EcoAppShell>
```

## Nav item

The active item takes a 2px accent bar, never a filled pill. In the rail, each item's label becomes a hover tooltip.

Vue (vue-ecosphere):

```vue
<EcoNavItem icon="mail-line" label="Requests" href="/requests" active :count="4" />
<!-- with vue-router installed, `to` renders through RouterLink and the route match sets the active state -->
<EcoNavItem icon="table-line" label="Activity" :to="{ name: 'activity' }" />
```

React (react-ecosphere):

```tsx
<EcoNavItem icon="mail-line" label="Requests" href="/requests" active count={4} />
{/* client-side routing: pass the router's link component as `as`, and its match as `active` */}
<EcoNavItem as={Link} to="/activity" icon="table-line" label="Activity" active={pathname === "/activity"} />
```

## EcoAppShell

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` | `string` | "Ecosphere" | Product name in the lockup. The system ships no logo file: set it in type. |
| `brandSuffix` | `string` | — | Qualifier after the name, set in --text-muted ("Campus"). |
| `brandLetter` | `string` | — | Letter on the 26px accent tile. Defaults to the first letter of brand. |
| `where` | `string` | — | Where you are, in the topbar. The #topbar slot replaces it. |
| `v-model:rail` | `boolean` | false | Collapse to the rail: puts data-rail on body (removed on unmount), which re-points --sidebar-w. |
| `v-model:open` | `boolean` | false | The off-canvas drawer below 1024px. Escape, the scrim and following a link close it. |
| `sidebarLabel / navLabel` | `string` | "Main" / "Primary" | Accessible names of the sidebar landmark and the navigation. |
| `contentTag` | `"main" \| "div"` | "main" | Element of the work area. `main` is the screen's main landmark; use `div` only when the slot renders its own `<main>`. |
| `topbarStyle` | `"inset" \| "island" \| "static" \| "none"` | "inset" | inset (recommended): sticky, transparent at rest, lifts into a floating glass bar once the page scrolls (a lit hairline, no shadow). island: the same, as a centred glass capsule. static: the older in-flow frosted bar. none: no topbar on desktop; #user moves to the sidebar foot beside the rail button, and below 1024px a slim bar keeps the burger. |
| `topbarAutoHide` | `boolean` | false | With inset or island: slide the bar away while scrolling down, bring it back on any scroll up. It stays while focus is inside it. Turn it on for the pages that need the room (long reading, long forms), not app-wide: bind it to the route, as in :topbar-auto-hide="!!route.meta.autoHide". |
| `scroller` | `HTMLElement \| string \| null` | null | The element that scrolls (or a selector), for the floating topbar to follow. Omit for the document. |
| `#user` | `slot` | — | The signed-in user (avatar, account menu): after #topbar-end, or in the sidebar foot with topbarStyle none. |
| `#brand` | `slot` | — | Replace the lockup with your own mark. |
| `#nav` | `slot` | — | EcoNavSection and EcoNavItem children. |
| `#sidebar-foot` | `slot` | — | Content in the sidebar foot, before the rail button. |
| `#topbar / #topbar-end` | `slot` | — | Replace topbar__where; controls at the end of the topbar (notifications, account). |
| `default` | `slot` | — | The work area: capped at --content-max, with the --page-x gutter on its left. .work__top, .split, .listpane and .page bring their own spacing; anything else gets the page's top, right and bottom spacing from the work area itself. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `brand` | `string` | "Ecosphere" | Product name in the lockup. The system ships no logo file: set it in type. |
| `brandSuffix` | `string` | — | Qualifier after the name, set in --text-muted ("Campus"). |
| `brandLetter` | `string` | — | Letter on the 26px accent tile. Defaults to the first letter of brand. |
| `where` | `string` | — | Where you are, in the topbar. The topbar prop replaces it. |
| `rail / onRailChange` | `boolean` | false | Collapse to the rail: puts data-rail on body (removed on unmount), which re-points --sidebar-w. |
| `open / onOpenChange` | `boolean` | false | The off-canvas drawer below 1024px. Escape, the scrim and following a link close it. |
| `sidebarLabel / navLabel` | `string` | "Main" / "Primary" | Accessible names of the sidebar landmark and the navigation. |
| `contentTag` | `"main" \| "div"` | "main" | Element of the work area. `main` is the screen's main landmark; use `div` only when the slot renders its own `<main>`. |
| `topbarStyle` | `"inset" \| "island" \| "static" \| "none"` | "inset" | inset (recommended): sticky, transparent at rest, lifts into a floating glass bar once the page scrolls (a lit hairline, no shadow). island: the same, as a centred glass capsule. static: the older in-flow frosted bar. none: no topbar on desktop; #user moves to the sidebar foot beside the rail button, and below 1024px a slim bar keeps the burger. |
| `topbarAutoHide` | `boolean` | false | With inset or island: slide the bar away while scrolling down, bring it back on any scroll up. It stays while focus is inside it. Turn it on for the pages that need the room (long reading, long forms), not app-wide: bind it to the route, as in :topbar-auto-hide="!!route.meta.autoHide". |
| `scroller` | `HTMLElement \| string \| null` | null | The element that scrolls (or a selector), for the floating topbar to follow. Omit for the document. |
| `user` | `ReactNode` | — | The signed-in user (avatar, account menu): after #topbar-end, or in the sidebar foot with topbarStyle none. |
| `lockup` | `ReactNode` | — | Replace the lockup with your own mark. |
| `nav` | `ReactNode` | — | EcoNavSection and EcoNavItem children. |
| `sidebarFoot` | `ReactNode` | — | Content in the sidebar foot, before the rail button. |
| `topbar / topbarEnd` | `ReactNode` | — | Replace topbar__where; controls at the end of the topbar (notifications, account). |
| `children` | `ReactNode` | — | The work area: capped at --content-max, with the --page-x gutter on its left. .work__top, .split, .listpane and .page bring their own spacing; anything else gets the page's top, right and bottom spacing from the work area itself. |

## EcoNavItem and EcoNavSection

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — | Label, and the rail tooltip (data-label). Required. |
| `icon` | `string` | — | RemixIcon name without the ri- prefix. |
| `href` | `string` | — | Plain link. |
| `to` | `string \| RouteLocation` | — | Router destination; uses RouterLink only when the app has vue-router installed. |
| `active` | `boolean` | false | Current page: is-active and aria-current="page". With to, the route match also counts. |
| `exact` | `boolean` | false | With to: only an exact route match is active. |
| `count` | `number \| string` | — | Count after the label (nav-item__n); hidden in the rail. |
| `EcoNavSection label` | `string` | — | Section label between groups (eyebrow navsec); hidden in the rail. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — | Label, and the rail tooltip (data-label). Required. |
| `icon` | `string` | — | RemixIcon name without the ri- prefix. |
| `href` | `string` | — | Plain link. |
| `to / as` | `string \| object / ElementType` | — | as is your router's link component (react-router's Link, Next.js's Link); it gets to (or href) and must render an a. Without as, a string to becomes the href. |
| `active` | `boolean` | false | Current page: is-active and aria-current="page". With a router, pass its match. |
| `count` | `number \| string` | — | Count after the label (nav-item__n); hidden in the rail. |
| `EcoNavSection label` | `string` | — | Section label between groups (eyebrow navsec); hidden in the rail. |
