Admin Shell
Foundational admin layout with sidebar, topbar, and main content area. Slot-driven for logo, navigation, breadcrumbs, user menu, and status indicators.
Preview
Welcome back
Your admin content renders here.
Collapsible rail
With collapsible, the sidebar folds to a 68px icon rail and back. The fold button sits beside the logo, and ⌘\ (Ctrl+\ off a Mac) does the same from anywhere. There is no hidden state: every destination stays one click away. Pass storageKey and the choice is remembered in that browser; a private window, where storage throws, just opens expanded. The width animates on the theme's --admin-shell-rail-duration (Paper: 480ms), and not at all under reduced motion. Below 48rem the rail is off and the sidebar becomes a sheet (see Phone).
Money
Fold the sidebar with the button beside the brand, or ⌘\ (Ctrl+\ off a Mac). The main area takes the width, and the choice is remembered in this browser.
The shell draws the rail through its existing slots. It narrows the sidebar, stacks the header, centres the nav and footer, and sets data-collapsed="true" on the shell and the sidebar so a slot can restyle itself:
- Mark labels with
data-admin-shell-label. In the rail they are hidden visually but stay in the accessibility tree, so an icon-only link keeps its name. Give the link atitlefor the hover tooltip. ProfileMenuinsidebarFooterfolds itself. It marks its name and caret withdata-admin-shell-label, so the rail shows just the avatar and the menu still opens upward.- Key anything else on
data-collapsed: a monogram in place of the wordmark, a count moved onto the icon as a badge.
[data-collapsed="true"] .wordmark { display: none; }
[data-collapsed="true"] .monogram { display: block; }
[data-collapsed="true"] .navLink { width: 44px; padding: 0; justify-content: center; }For a controlled shell, pass collapsed and onCollapsedChange. Set collapseShortcut to another key, or to false when the app already uses ⌘\.
Phone
Below 48rem the sidebar is hidden and the main column takes the full width. A menu button at the start of the topbar opens the sidebar as a sheet from the left, over a blurred --overlay-bg scrim. The sheet is the same sidebar with the same slots, so nothing remounts when the width crosses 48rem.
- Closing. Esc, a tap on the scrim, and a tap on any link in the sheet close it. The sheet also closes if the window widens past 48rem.
- Focus. Opening moves focus to the first item in the sheet. Tab and Shift+Tab stay inside the sheet. Closing returns focus to the menu button.
- The page behind. The topbar and main column are
inertwhile the sheet is open, and the page does not scroll. - Motion. The sheet slides in on
--motion-duration-normal, and does not slide under reduced motion. hideTopbar. A phone still gets a bar that holds only the menu button, so the nav can always be reached.
The breakpoint is the viewport, not the preview box. To see the sheet, open this page on a phone (or narrow the window below 48rem), press Fullscreen on either preview above, then press the menu button.
Installation
npx visor add --block admin-shellThis copies files into your project:
blocks/admin-shell/admin-shell.tsx— the block componentblocks/admin-shell/admin-shell.module.css— the styles
Admin Shell is a pure slot component — it imports only the utils helper to
render, so the default install stays lean (no Radix). The breadcrumb,
dropdown-menu, and sidebar components are suggested slot-fills: common
choices for the topbar and sidebar slots, but not required. Add them when you
want them:
# Bring the suggested slot-fill components along
npx visor add --block admin-shell --with-suggested
# …or add just the ones you need, à la carte
npx visor add breadcrumb dropdown-menu sidebarUsage
'use client';
import { AdminShell } from '@/blocks/admin-shell/admin-shell';
import { Breadcrumb, BreadcrumbItem, BreadcrumbList } from '@/components/ui/breadcrumb/breadcrumb';
export default function AdminLayout({ children }: { children: React.ReactNode }) {
return (
<AdminShell
logo={<img src="/logo.svg" alt="Acme" />}
sidebarNav={
<>
<a href="/admin">Dashboard</a>
<a href="/admin/users">Users</a>
<a href="/admin/billing">Billing</a>
<a href="/admin/settings">Settings</a>
</>
}
sidebarFooter={<UserMenu />}
breadcrumb={
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>Admin</BreadcrumbItem>
<BreadcrumbItem>Users</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
}
topbarCenter={<StatusIndicators />}
topbarEnd={<ThemeToggle />}
>
{children}
</AdminShell>
);
}Layout
The shell is a two-column flex layout:
- Left column — A sticky sidebar containing (top to bottom) a branding slot, a scrollable navigation area, and a footer slot for the user menu.
- Right column — A sticky topbar above a scrollable
<main>element. The topbar has three slots: start (breadcrumb + extras), center (status indicators, search), and end (user menu, theme toggle).
The <main> element carries id="admin-main-content" so the built-in skip link (visible on keyboard focus) can jump past the chrome.
Theming
Every rule the shell draws is a component token, so a theme can drop them instead of overriding the data-slot hooks. Unbound, each falls back to today's value.
| Token | Draws | Default |
|---|---|---|
--admin-shell-sidebar-border | Rule between the sidebar and the body | 1px solid var(--border-default) |
--admin-shell-sidebar-header-border | Rule under the sidebar header | 1px solid var(--border-muted) |
--admin-shell-sidebar-footer-border | Rule above the sidebar footer | 1px solid var(--border-muted) |
--admin-shell-topbar-bg | Topbar fill | var(--surface-card) |
--admin-shell-topbar-border | Rule under the topbar | 1px solid var(--border-default) |
--admin-shell-rail-width | Sidebar width in the rail | 4.25rem (68px) |
--admin-shell-rail-duration | Fold duration | var(--motion-duration-slow) |
--admin-shell-rail-easing | Fold easing | var(--motion-easing-default) |
Bind them under components.admin-shell in a .visor.yaml. The paper theme sets the borders to none and the topbar to var(--surface-page), so its shell separates surfaces by tone alone, and folds the rail on a 480ms cubic-bezier(0.2, 0.8, 0.2, 1). See Component tokens.
Accessibility
- Skip link (visually hidden, visible on focus) jumps to
#admin-main-content. <aside aria-label="Primary navigation">wraps the sidebar.<nav aria-label="Sidebar">wraps the nav slot.<header role="banner">wraps the topbar.<main role="main">withtabIndex={-1}allows the skip link to move focus into the content area.- Below 48rem the menu button is named "Menu" (a 44px target) and carries
aria-expandedandaria-controls. While the sheet is open, the rest of the shell isinertand focus is held in the sheet. - The fold button is named "Collapse the sidebar" or "Expand the sidebar", carries
aria-expanded,aria-controlsandaria-keyshortcuts, and keeps focus when pressed. Rail items stay in the Tab order, named by theirdata-admin-shell-labeltext.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
logo | ReactNode | — | Branding slot at the top of the sidebar. |
sidebarNav | ReactNode | — | Required. Navigation content. Consumer provides their own link list. |
sidebarFooter | ReactNode | — | Bottom-of-sidebar slot (user menu, logout, theme toggle). |
sidebarWidth | number | string | 256 | Sidebar width. Numbers are pixels; strings pass through. |
collapsible | boolean | false | Draw the fold button and allow the icon rail. Desk only. |
defaultCollapsed | boolean | false | Initial state when nothing is remembered. |
collapsed | boolean | — | Controlled state. |
onCollapsedChange | (collapsed: boolean) => void | — | Called with the next state from the button or the key. |
collapseShortcut | string | false | "\\" | Key pressed with ⌘ or Ctrl that folds the sidebar. false turns it off. |
storageKey | string | — | localStorage key that remembers the state per browser. |
breadcrumb | ReactNode | — | Rendered at the start of the topbar. |
topbarStart | ReactNode | — | Left side of the topbar, after the breadcrumb. |
topbarCenter | ReactNode | — | Center slot for status indicators, search, etc. |
topbarEnd | ReactNode | — | Right side of the topbar. |
hideTopbar | boolean | false | When true, no topbar is rendered. Below 48rem a bar holding only the menu button still is. |
children | ReactNode | — | Required. Main content. |
mainMaxWidth | number | string | — | Optional max-width for the main content area. |
mainPadding | "none" | "sm" | "md" | "lg" | "lg" | Padding applied inside the main content area. |
className | string | — | Additional CSS class on the root element. |
About Blocks
Blocks are complete UI patterns made up of multiple Visor components. Unlike individual components, blocks represent larger, composed sections of UI — such as admin shells, login forms, or dashboard panels.
Blocks are copy-and-own, just like components. Install them into your project and customize freely.
Admin Settings Page
Long scrollable settings archetype with labeled sections, optional sticky left-side nav with intersection-observer highlight, and either a global sticky save footer (default) or per-section save/revert rows.
Admin Shell — Editorial Density Showcase
Hardening showcase composing AdminShell in the admin-v7-r3 editorial-density pattern — WorkspaceSwitcher in the logo slot, ChromeButton cluster in topbarEnd, eyebrow-grouped nav, sidebar footer with Avatar + Kbd.