App shell
The shell of an application screen: a sidebar of sections that collapses to its icons on a desktop and opens as a drawer on a phone, a sticky header with the screen's title, a search that opens the command palette and its actions, the content — and the keyboard shortcuts a console lives by (⌘B, ⌘K, g then a letter).
- Domain
- Navigation & shell
- Support level
- Size
- 9.2 kB gzip, budget 18.0 kB
- Who uses it
- 4 files of the live products and sites import it (Verikora: 3) Counted in the dated inventory of 2026-11-23.
import { AppShell, useShortcuts, formatShortcut, acceleratorOf } from "@krizaka/ui/app-shell";Web only — React, from @krizaka/ui/app-shell. Beta: its API may still change in a minor version.
- Mobile · n/a. On a phone the app shell is a tab bar, a header and a screen. → Tab bar
Why it is here. Used by Verikora, Folioviv.
When to use
- Every signed-in screen of a product: a studio, a console, an administration.
- When the app has more than four destinations — fewer fit a NavBar.
When not to use
- For a public page of a site.Use instead: Marketing layout
- For a mobile app's tabs: React Native has its own tab bar.
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { AppShell, useShortcuts, formatShortcut, acceleratorOf } from "@krizaka/ui/app-shell";Examples
Console
A finance console: sections with g shortcuts, ⌘K that opens the palette, a server-side table that refreshes when a form creates a row.
Creator studio
Elena's home in the creator studio: the shell around this week's figures, the payout, the auction and the sales.
Administration console
A review queue in a console: sections, counts and a sortable table with bulk actions (cards on a phone).
The shell alone
Sidebar with a group and a count, header with an action, the content.
A brand name and a text footer that collapse cleanly
Collapsed, only the mark shows; the name and the footer text fade and narrow with the sidebar, never spilling over the content.
Desktop window
The Sovkora Mac app's window (desktop): the title bar moves the window and clears the traffic lights, no drawer, the desktop's density, ⌘1–⌘3 to the sections.
Props
AppShellRoot
The shell: holds the collapse (desktop) and the drawer (phone) state. Children: Sidebar, then Body.
| Prop | Type | Default | Description |
|---|---|---|---|
collapsed | boolean | — | Controlled collapse (desktop): pair with onCollapsedChange to persist the choice. |
collapseShortcut | string | false | mod+b | The shortcut that folds and unfolds the sidebar (a combination: mod+b is ⌘B on a Mac, Ctrl+B elsewhere), or false
for none. |
defaultCollapsed | boolean | false | The sidebar starts collapsed to its icons (desktop). |
desktop | boolean | false | The shell is a desktop app's window (the Sovkora Mac app, Tauri 2 — ADR-002): no drawer, the sidebar's top clears the
window's traffic lights (--kz-titlebar-inset, 28 px; the window's height is --kz-window-height, the viewport by default), the header and that top move the window
(data-tauri-drag-region), a denser layout, the chrome not selectable. In a browser it is a fixed-height shell. |
onCollapsedChange | ((collapsed: boolean) => void) | — | Called when the sidebar collapses or expands. |
skipLabel | string | — | The words of the "skip to content" link (Skip to content), the first tab stop; it lands on AppShell.Main. Without it, no link. |
AppShellSidebar
The sidebar: on a desktop a column that collapses to its icons; on a phone the same content in a drawer.
| Prop | Type | Default | Description |
|---|---|---|---|
childrenrequired | ReactNode | — | The sections: AppShell.Group and AppShell.Item. |
closeLabelrequired | string | — | The drawer's close button words (phone). |
labelrequired | string | — | The navigation's accessible name (Studio, Administration). |
brand | ReactNode | — | The brand at the top: the product's mark and name (a link home through asChild of your router, or plain). |
collapseLabels | readonly [string, string] | — | The collapse button's words, [collapse, expand] (desktop only). Without it the sidebar cannot collapse. |
footer | ReactNode | — | At the bottom, above the collapse button: the account, a plan, the version. |
AppShellItem
A destination of the sidebar: icon, words, a count.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | Its words: the accessible name, hidden visually when collapsed (the icon carries a tooltip through title). |
asChild | boolean | — | Renders your link (Next's Link) with the item's look: pass it as the only child. |
badge | ReactNode | — | A count beside it (unread, pending): a number or a few characters. |
children | ReactElement<unknown, string | JSXElementConstructor<any>> | — | Your link element when asChild. |
current | boolean | — | The screen it opens is the current one: aria-current="page". |
icon | ReactNode | — | The item's icon (a signature icon): it stays when the sidebar collapses. |
shortcut | string | — | A keyboard shortcut that goes to it: a sequence (g d: G then D) or a combination (mod+1). It clicks the item, so a
router link navigates. The keys are shown on hover and focus when the sidebar is open. |
AppShellHeader
The top of the screen: the drawer's button (phone), the title, the actions. Sticky.
| Prop | Type | Default | Description |
|---|---|---|---|
menuLabelrequired | string | — | The button that opens the drawer on a phone: its words. |
actions | ReactNode | — | The screen's actions, on the right. |
title | ReactNode | — | The screen's title (an h1). |
AppShellSearch
The header's search: a button that looks like a field (a magnifier, its words, ⌘K) and opens the app's command palette.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | The words ("Search", "Search creators"): the accessible name, shown beside the keys on a desktop. |
onOpenrequired | () => void | — | Called when the button is pressed or the shortcut is typed: open your command palette (CommandDialog) here. |
shortcut | string | mod+k | The shortcut that opens it (a combination); shown on its keys. |
Accessibility
skipLabelonAppShell.Rootadds the skip link (WCAG 2.4.1): the first tab stop, landing onAppShell.Main.- The sidebar is a
navnamed bylabel; the current item carriesaria-current="page". - On a phone the drawer is a modal dialog (Radix): focus trapped inside, Escape and the overlay close it, the focus returns to the button.
- The header's title is the screen's
h1; nested layouts useheadingAs="h2". - A combination is announced with
aria-keyshortcuts(Control+K,Meta+Kon a Mac); a sequence is not a chord, so it is only shown on its keys, never named to assistive technology. - The platform's keys are known after the first client render (⌘ on a Mac, Ctrl elsewhere): the server and the first render agree.
- With
desktop, the drag regions are the header, its title and the sidebar's top only — never a control — so every button, link and field keeps its focus and its click; the chrome is not selectable, the content is.
Keyboard
| Keys | Action |
|---|---|
| Tab | Moves through the sidebar's items, the collapse button and the header's actions. |
| Esc | Closes the drawer on a phone and returns the focus to the menu button. |
| ⌘B / Ctrl+B | Folds and unfolds the sidebar (collapseShortcut, off with false). |
| ⌘K / Ctrl+K | Opens the command palette from AppShell.Search, in a text field too. |
| G then a letter | Goes to the section whose shortcut it is; plain keys never fire while typing in a field. |
Best practices
- Five to nine items, grouped by what the user does (
AppShell.Group), the current one marked withcurrent. - Give every item an icon: it is all that remains when the sidebar collapses (its words become a tooltip).
- Persist the collapse with
collapsed+onCollapsedChange; put the account in the sidebar'sfooter. - Render your router's links with
AppShell.Item asChild. - Give the sections a
shortcut(g p: G then P): it clicks the item, so a router link navigates, and the keys show on hover and focus. - Put
AppShell.Searchin the header and open yourCommandDialogfrom itsonOpen: ⌘K (Ctrl+K) opens it from anywhere. - In a desktop app (the Sovkora Mac app, Tauri 2) pass
desktop: the header and the sidebar's top become the title bar that moves the window, there is no drawer, the density is the desktop's; build the native menu bar from the same shortcuts withacceleratorOf(mod+k→CmdOrCtrl+K).
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub