Skip to content

Layout

PageShell

The standard page container with a title, a description and an actions slot.

<script>
  import { PageShell, Button } from "@codeatlasdev/ui";
</script>

<PageShell title="Dashboard" description="Overview of this month">
  {#snippet actions()}<Button size="sm">New report</Button>{/snippet}
  <!-- page content -->
</PageShell>

PageShell never renders <main>. Inside AppShellLayout the shell is the <main id="main"> landmark; on a page with no shell (a one-screen app) wrap it yourself, with a skip link first, or axe reports landmark-one-main:

<script>
  import { PageShell, SkipLink } from "@codeatlasdev/ui";
</script>

<SkipLink />
<main id="main" tabindex="-1">
  <PageShell title="Pipeline">…</PageShell>
</main>

A one-page app does not need AppShellLayout for this. See the Standalone page recipe.

Below 900px the header stacks: the description leads and actions wrap onto their own row. Buttons share that row full-width (large tap targets); everything else (IconButton, ThemeToggle, StatusChip, Chip, Badge, plain text) keeps its natural size and stays at the end of the row.

The shell renders title as the page <h1>; below 900px inside an AppShellLayout it is hidden visually because the mobile header already shows it. Inside a PageShell, AppSettings or AppForm, EmptyState and FormSection titles default to <h2> (under the page <h1>). Pass headingLevel to EmptyState, FormSection or Card to pick the level explicitly.

#187

Dashboard page

KPI cards and a content card inside a PageShell.

Dashboard

Overview of this month

Revenue
$118k
↑+23.4%
Users
24.8k
↑+8.1%
Growth
34%
↑+5.6%
Uptime
99.9%
↑+0.1%

Chart or data table goes here

Reference #187 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { PageShell, KpiCard, KpiGrid, Card, Stack, Button } from '@codeatlasdev/ui';
  import { TrendingUp, Users, DollarSign, Activity } from '@lucide/svelte';
</script>

<Card flush full>
  <PageShell title="Dashboard" description="Overview of this month">
    {#snippet actions()}<Button variant="filled" size="sm">New report</Button>{/snippet}

    <Stack gap="6">
      <KpiGrid>
        <KpiCard title="Revenue" value="$118k" trend={23.4} icon={DollarSign} />
        <KpiCard title="Users" value="24.8k" trend={8.1} icon={Users} />
        <KpiCard title="Growth" value="34%" trend={5.6} icon={TrendingUp} />
        <KpiCard title="Uptime" value="99.9%" trend={0.1} icon={Activity} />
      </KpiGrid>

      <Card full>
        <p class="placeholder">Chart or data table goes here</p>
      </Card>
    </Stack>
  </PageShell>
</Card>

<style>
  .placeholder {
    margin: 0;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ca-text-hint);
    font-size: var(--ca-font-size-body2);
  }
</style>

Aside and reading width

Pass an aside snippet for a companion column (in-page index, summary, help, preview). When the shell itself is at least 60rem wide the aside sits next to the content (about 17rem, sticky); below that it follows the content. The breakpoint is the shell’s width, not the viewport’s, so an open AppShellLayout panel is accounted for. It renders as <aside>; name it with asideLabel when a page has more than one complementary landmark.

width="reading" caps the content column at 46rem so forms and settings keep a readable line length instead of stretching to maxWidth. With an aside the pair is centred. width="wide" (default) is the previous behaviour.

#600

Reading width with an aside

width="reading" plus an aside snippet holding a section index.

Workspace settings

Reading width keeps the form at a comfortable line length.

General

Reference #600 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { PageShell, Card, TextField, Stack } from '@codeatlasdev/ui';

  let name = $state('Acme Inc.');
  let slug = $state('acme');
</script>

<div class="stage">
  <PageShell title="Workspace settings" description="Reading width keeps the form at a comfortable line length." width="reading" asideLabel="Sections">
    {#snippet aside()}
      <Card full>
        <nav class="index" aria-label="On this page">
          <a href="#general">General</a>
          <a href="#billing">Billing</a>
          <a href="#danger">Danger zone</a>
        </nav>
      </Card>
    {/snippet}

    <Card full title="General">
      <Stack gap="4">
        <TextField label="Name" bind:value={name} />
        <TextField label="Slug" bind:value={slug} />
      </Stack>
    </Card>
  </PageShell>
</div>

<style>
  .stage {
    --ca-vh: 420px;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 420px;
    contain: layout paint;
    overflow: hidden;
    border-radius: var(--ca-radius-lg);
    box-shadow: inset 0 0 0 1px var(--ca-outline-subtle);
  }
  .index {
    display: flex;
    flex-direction: column;
    gap: var(--ca-space-2);
  }
  .index a {
    color: var(--ca-text-secondary);
    font-size: var(--ca-font-size-body2);
    text-decoration: none;
  }
  .index a:hover {
    color: var(--ca-text-primary);
  }
</style>

Props

PropTypeDefaultDescription
titlestring–Page title.
descriptionstring–Supporting text under the title.
gapnumberundefinedVertical gap between the header and the content, in px. Omit for `--ca-space-7` (28px at the default density).
maxWidthstringundefinedMaximum width of the content column, any CSS length. Omit for 80rem (1280px at the default 4px spacing unit).
width'reading' | 'wide''wide'`reading` caps the content column at 46rem (forms, settings). `wide` fills the shell up to `maxWidth`.
actionsSnippet–Right side of the page header.
asideSnippet–Companion column rendered as `<aside>`: beside the content (sticky, ~17rem) when the shell is at least 60rem wide, after the content below that.
asideLabelstring'Page sidebar'Accessible name of the `<aside>` landmark (localized default).
childrenSnippet–Page content.
classstring''Extra class names.