Skip to content

AppShell

The frame of every signed-in page: a top bar that says where you are, the navigation of the area, and the content. On a phone the navigation moves to the bottom, with five named items and «More».

import { AppShell, Logo, CommandPalette } from '@sypnia/ui/react'

On this page
  1. A console, on a desktop
  2. The same console, on a phone
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

A console, on a desktop

This is a real page made only of library pieces. Press ⌘K or Ctrl K inside it, open the account menu, sort the table.

The same console, on a phone

The navigation is at the bottom: five places with their names, and «More» for the rest. The table has become cards.

Code
import { useState } from 'react';
import {
  AppShell, Badge, Breadcrumb, Button, CommandPalette, IconButton, Logo, Menu, MenuItem, MenuSeparator, Page, PageHeader,
  Stat, StatGroup, Status, Table, Toaster, toast, useHotkey, useSypnia, type Column, type NavItem, type RenderLink,
} from '@sypnia/ui/react';

const nav: NavItem[] = [
  { href: '/project/shop', label: 'Overview', icon: 'home' },
  { href: '/project/shop/tables', label: 'Tables', icon: 'table' },
  { href: '/project/shop/sql', label: 'SQL', icon: 'query' },
  { href: '/project/shop/users', label: 'Users', icon: 'users' },
  { href: '/project/shop/keys', label: 'API keys', icon: 'key' },
  { href: '/project/shop/policies', label: 'Policies', icon: 'shield' },
  { href: '/project/shop/logs', label: 'Logs', icon: 'logs' },
  { href: '/project/shop/settings', label: 'Settings', icon: 'settings' },
  { href: '/account', label: 'Account', icon: 'user', foot: true },
  { href: 'https://data.docs.sypnia.com', label: 'Docs', icon: 'book-open', foot: true, external: true },
];

interface Row { name: string; rows: number; size: number; policies: number; updated: string }
const tables: Row[] = [
  { name: 'orders', rows: 18240, size: 9_437_184, policies: 3, updated: '2026-11-17T14:02:00Z' },
  { name: 'order_items', rows: 51873, size: 21_495_808, policies: 2, updated: '2026-11-17T14:02:00Z' },
  { name: 'customers', rows: 4310, size: 2_202_009, policies: 4, updated: '2026-11-16T09:41:00Z' },
  { name: 'products', rows: 126, size: 180_224, policies: 1, updated: '2026-11-12T18:20:00Z' },
  { name: 'refunds', rows: 0, size: 8192, policies: 0, updated: '2026-11-03T08:00:00Z' },
];

export default function Console() {
  const { format } = useSypnia();
  const [path, setPath] = useState('/project/shop/tables');
  const [palette, setPalette] = useState(false);
  useHotkey('k', () => setPalette((p) => !p));
  // In a real app this is the router's Link. Here a click only changes the current path.
  const link: RenderLink = ({ href, children, onClick, ...rest }) => (
    <a href={href} {...rest} onClick={(e) => { e.preventDefault(); setPath(href); onClick?.(); }}>{children}</a>
  );
  const columns: Column<Row>[] = [
    { id: 'name', header: 'Table', cell: (r) => <code>{r.name}</code>, sortValue: (r) => r.name },
    { id: 'rows', header: 'Rows', numeric: true, cell: (r) => format.number(r.rows), sortValue: (r) => r.rows },
    { id: 'size', header: 'Size', numeric: true, cell: (r) => format.bytes(r.size), sortValue: (r) => r.size },
    { id: 'policies', header: 'Access', cell: (r) => (r.policies ? <Badge tone="ok" dot>{r.policies} policies</Badge> : <Badge tone="warn" icon="warning">No policies</Badge>) },
    { id: 'updated', header: 'Last change', cell: (r) => format.relative(r.updated), sortValue: (r) => r.updated },
    { id: 'actions', header: 'Actions', actions: true, cell: (r) => <IconButton size="sm" icon="more" label={`Actions for ${r.name}`} /> },
  ];
  const title = nav.find((n) => n.href === path)?.label ?? 'Tables';
  return (
    <>
      <AppShell brand={<Logo product="Data" />} nav={nav} current={path} exact={['/project/shop']} renderLink={link} onSearch={() => setPalette(true)}
        where={<Breadcrumb items={[{ label: 'Acme', onClick: () => setPath('/project/shop') }, { label: 'shop' }]} />}
        tools={
          <Menu trigger={<IconButton icon="user" label="Account" variant="secondary" />}>
            <MenuItem icon="user" onAction={() => setPath('/account')}>Account</MenuItem>
            <MenuItem icon="globe">Español</MenuItem>
            <MenuSeparator />
            <MenuItem icon="sign-out">Sign out</MenuItem>
          </Menu>
        }>
        <Page>
          <PageHeader title={title} lead="Everything your app stores, as tables you can open, edit and protect."
            actions={<><Button icon="upload">Import CSV</Button><Button variant="primary" icon="plus" onClick={() => toast('Table created')}>New table</Button></>} />
          <StatGroup>
            <Stat label="Tables" value={format.number(tables.length)} />
            <Stat label="Rows" value={format.compact(74549)} delta="+1,204 today" trend="good" />
            <Stat label="Storage" value="31.8" unit="MB" delta="6% of your plan" />
            <Stat label="Database" value={<Status tone="ok" live>Healthy</Status>} />
          </StatGroup>
          <Table label="Tables" columns={columns} rows={tables} rowKey={(r) => r.name} />
        </Page>
      </AppShell>
      <CommandPalette open={palette} onClose={() => setPalette(false)}
        commands={[
          ...nav.filter((n) => !n.external).map((n) => ({ id: n.href, label: n.label, icon: n.icon, group: 'Go to', hint: 'shop', onSelect: () => setPath(n.href) })),
          { id: 'new-table', label: 'New table', icon: 'plus' as const, group: 'Do', onSelect: () => toast('Table created') },
          { id: 'invite', label: 'Invite a teammate', icon: 'user-plus' as const, group: 'Do', onSelect: () => toast('Invitation sent') },
        ]} />
      <Toaster />
    </>
  );
}

Skeleton

The same console before the session is known: the frame, the navigation and the page as skeletons, at their real sizes.

Code
import { AppShellSkeleton, BreadcrumbSkeleton, ChartSkeleton, FormSectionSkeleton, Page, TabsSkeleton } from '@sypnia/ui/react';

// The first paint of a console, before the session says which project and which items: the frame and the page are
// skeletons at their real sizes, so nothing moves when the real ones arrive.
export default function ShellSkeleton() {
  return (
    <AppShellSkeleton items={8}>
      <Page>
        <div className="sy-stack">
          <BreadcrumbSkeleton items={2} />
          <TabsSkeleton items={3} />
          <ChartSkeleton height={200} legend={2} />
          <FormSectionSkeleton fields={2} />
        </div>
      </Page>
    </AppShellSkeleton>
  );
}

When to use it

Use it when

  • Every page of a console, behind sign-in. One shell per app, so every Sypnia console feels like the same place.
  • The navigation has up to five main places. More than five still works: the rest go under «More» on phones.

Do not use it when

  • Pages before sign-in (sign in, sign up, onboarding): they have their own, simpler frame.
  • Documentation and landings: they use the docs and site pieces.
  • You want a second sidebar or a custom header: ask for it here first, so every console gets it.

For everyone

  • The first Tab stop is «Skip to content», which moves the focus past the navigation.
  • Top bar, navigation and content are landmarks (header, nav, main), each with a name.
  • The current place is marked with aria-current="page", and with the light, never with colour alone.
  • On phones every item of the bottom bar has its name under the icon and is at least 56 px tall.
  • The search button says its shortcut the way this person will press it: ⌘ K on Apple keyboards, Ctrl K elsewhere.

Props

AppShellTypeDefault
brandrequired

The logo, usually <Logo product="Data" />.

ReactNode
currentrequired

The href of the current place. An item is current when this equals its href or starts with it followed by «/».

string
navrequired

The navigation of this area. On phones the first five show at the bottom with their names; the rest go under «More».

NavItem[]
banner

A message about the whole app, above everything.

ReactNode
brandHref string /
brandLabel string Sypnia
exact

Hrefs that are current only on an exact match (an «Overview» at the root of a section).

string[] []
onSearch

Shows the search button with its shortcut; it should open a CommandPalette.

(() => void)
renderLink RenderLink ({ children, ...p }) => <a {...p}>{children}</a>
tools

Right side of the top bar: account menu, notifications.

ReactNode
where

Where the person is: usually a Breadcrumb with the organization and project switchers.

ReactNode
LogoTypeDefault
product string
CommandPaletteTypeDefault
commandsrequired Command[]
onCloserequired () => void
openrequired boolean
placeholder string
  1. A console, on a desktop
  2. The same console, on a phone
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms