Krizaka UI
Krizaka UI

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).

Web · ✓Mobile · n/aBureau · ✓ forme bureauBêtaMises en page
Niveau de support
Bêta
Taille
9.2 kB gzip, budget 18.0 kB
Qui l'utilise
4 fichiers des produits et sites en production l'importent (Verikora : 3) Compté dans l'inventaire daté du 2026-11-23.
import { AppShell, useShortcuts, formatShortcut, acceleratorOf } from "@krizaka/ui/app-shell";

Web uniquement — React, depuis @krizaka/ui/app-shell. Bêta : son API peut encore changer à une version mineure.

  • Mobile · n/a. On a phone the app shell is a tab bar, a header and a screen. → Tab bar

Pourquoi il est là. Used by Verikora, Folioviv.

Quand l’utiliser

  • 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.

Quand ne pas l’utiliser

  • For a public page of a site.À la place : Marketing layout
  • For a mobile app's tabs: React Native has its own tab bar.

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Importer

import { AppShell, useShortcuts, formatShortcut, acceleratorOf } from "@krizaka/ui/app-shell";

Exemples

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.

PropTypeDéfautDescription
collapsedboolean—Controlled collapse (desktop): pair with onCollapsedChange to persist the choice.
collapseShortcutstring | falsemod+bThe shortcut that folds and unfolds the sidebar (a combination: mod+b is ⌘B on a Mac, Ctrl+B elsewhere), or false for none.
defaultCollapsedbooleanfalseThe sidebar starts collapsed to its icons (desktop).
desktopbooleanfalseThe 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.
skipLabelstring—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.

PropTypeDéfautDescription
childrenrequisReactNode—The sections: AppShell.Group and AppShell.Item.
closeLabelrequisstring—The drawer's close button words (phone).
labelrequisstring—The navigation's accessible name (Studio, Administration).
brandReactNode—The brand at the top: the product's mark and name (a link home through asChild of your router, or plain).
collapseLabelsreadonly [string, string]—The collapse button's words, [collapse, expand] (desktop only). Without it the sidebar cannot collapse.
footerReactNode—At the bottom, above the collapse button: the account, a plan, the version.

AppShellItem

A destination of the sidebar: icon, words, a count.

PropTypeDéfautDescription
labelrequisstring—Its words: the accessible name, hidden visually when collapsed (the icon carries a tooltip through title).
asChildboolean—Renders your link (Next's Link) with the item's look: pass it as the only child.
badgeReactNode—A count beside it (unread, pending): a number or a few characters.
childrenReactElement<unknown, string | JSXElementConstructor<any>>—Your link element when asChild.
currentboolean—The screen it opens is the current one: aria-current="page".
iconReactNode—The item's icon (a signature icon): it stays when the sidebar collapses.
shortcutstring—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.

PropTypeDéfautDescription
menuLabelrequisstring—The button that opens the drawer on a phone: its words.
actionsReactNode—The screen's actions, on the right.
titleReactNode—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.

PropTypeDéfautDescription
labelrequisstring—The words ("Search", "Search creators"): the accessible name, shown beside the keys on a desktop.
onOpenrequis() => void—Called when the button is pressed or the shortcut is typed: open your command palette (CommandDialog) here.
shortcutstringmod+kThe shortcut that opens it (a combination); shown on its keys.

Accessibilité

  • skipLabel on AppShell.Root adds the skip link (WCAG 2.4.1): the first tab stop, landing on AppShell.Main.
  • The sidebar is a nav named by label; the current item carries aria-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 use headingAs="h2".
  • A combination is announced with aria-keyshortcuts (Control+K, Meta+K on 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.

Clavier

TouchesAction
TabMoves through the sidebar's items, the collapse button and the header's actions.
EscCloses the drawer on a phone and returns the focus to the menu button.
⌘B / Ctrl+BFolds and unfolds the sidebar (collapseShortcut, off with false).
⌘K / Ctrl+KOpens the command palette from AppShell.Search, in a text field too.
G then a letterGoes to the section whose shortcut it is; plain keys never fire while typing in a field.

Bonnes pratiques

  • Five to nine items, grouped by what the user does (AppShell.Group), the current one marked with current.
  • 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's footer.
  • 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.Search in the header and open your CommandDialog from its onOpen: ⌘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 with acceleratorOf (mod+k → CmdOrCtrl+K).

Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page