Skip to content

Layout

Every app page sits inside the app shell:

  • the sidebar (or top nav);
  • the top bar with breadcrumbs, search, theme and notifications;
  • ⌘K search;
  • the theme drawer;
  • the phone menu.

Sign-in pages and error pages have no shell.

1. Three layouts

Layout What it looks like Best for
sidebar 248 px sidebar with labels Most apps (default)
collapsed 72 px icon rail; labels show as tooltips Wide tables, calendars, Kanban
topnav No sidebar; a menu per group in the top bar Apps with few pages, marketing-style admin
sidebar collapsed topnav
Sidebar layout Collapsed layout Top nav layout

Set the default in config/site.config.ts:

theme: { layout: "sidebar", /* … */ }

People can switch in the theme drawer (the sliders icon in the top bar). The button at the far left of the top bar also toggles between sidebar and collapsed. Their choice is saved in their browser.

Lock one layout: set theme.allowCustomise: false. The drawer and the mode buttons disappear.

2. Phones and tablets

Analytics on a phone, dark mode

Below 1024 px wide, the sidebar hides and a ☰ button opens it as a drawer. The drawer closes when a link is tapped. Below 640 px:

  • the search box becomes a 🔍 button;
  • the theme buttons move into the account menu at the bottom of the drawer.

3. The parts

All parts live in src/layout/ and are exported, so you can rearrange them:

Part File What it does
AppShell app-shell.tsx Puts everything together; picks the layout from the theme setting
Sidebar sidebar.tsx Brand, workspace switcher, menu groups, account menu
TopNav top-nav.tsx The topnav layout's bar with a menu per group
Topbar topbar.tsx Menu toggle, breadcrumbs, search box, action buttons
Breadcrumbs breadcrumbs.tsx Section › parent › page, from config/routes.ts
CommandMenu command-menu.tsx ⌘K: pages, people, actions, "search everything"
ThemeDrawer theme-drawer.tsx Mode, accent, layout, density, animations
NotificationsPanel notifications-panel.tsx The bell and its list
UserMenu user-menu.tsx Avatar menu: profile, theme, help, sign out
MobileNav mobile-nav.tsx The sidebar in a drawer
PageHeader page-header.tsx Title, description and actions at the top of a page

⌘K, the theme drawer and the phone menu load the first time they open, so the first page load stays small.

4. Common changes

Remove the workspace switcher. In sidebar.tsx, delete {!collapsed && <WorkspaceSwitcher />}.

Change the sidebar width. In app-shell.tsx, change 248 (expanded) and 72 (collapsed).

Add a button to the top bar. In topbar.tsx, add an IconButton inside TopbarActions:

<IconButton label="Help" onClick={() => navigate("/faq")}>
  <CircleHelp />
</IconButton>

Every icon button has a tooltip and an accessible label from label.

Remove a top-bar button. Delete it from TopbarActions. For example, notifications: remove <NotificationsPanel />.

Change the version badge next to the name: in sidebar.tsx, edit v1.2 or delete the <span>.

Limit the content width. In app-shell.tsx, the page sits in max-w-[1600px]. Change it, or remove it for full width.

5. Opening ⌘K or the theme drawer from your code

import { useShell } from "@pulze/layout"

const { openSearch, openTheme, openMobileNav } = useShell()
<Button onClick={openTheme}>Change theme</Button>

6. Keyboard

Keys Action
⌘K / Ctrl+K Open or close search
/ Open search (when you're not typing in a field)
↑ ↓ Enter Move through and open search results
Esc Close search, drawers, menus
Tab on page load "Skip to content" link, for keyboard and screen-reader users