Skip to content
Hazine

App Shell with Inset Sidebar

Application frame with a sidebar, a top bar holding the sidebar trigger and breadcrumb, and a rounded inset main region with the page title. The default starting point for a SaaS product.

How it differs. Two regions: the page sits as an inset frame on the sidebar surface and scrolls under a fixed top bar. The sidebar slides off canvas on wide screens and becomes a modal sheet on narrow ones.

Install

pnpm dlx shadcn@latest add @hazine/app-shell-sidebar-inset

Adds 2 files, 6 shadcn primitives (breadcrumb, button, kbd, separator, sidebar, tooltip), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 1 package (lucide-react).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props16

workspace
ShellWorkspace = DEFAULT_WORKSPACE
Name, plan and home link shown at the top of the sidebar.
navigation
ShellNavGroup[] = DEFAULT_NAVIGATION
Navigation groups. Each group renders a label and a list of links.
current
string
Id of the navigation item for the page on screen, when controlled by your router.
defaultCurrent
string
Initial current item when uncontrolled. Defaults to the first item.
onCurrentChange
(id: string) => void
Called with the item id when a navigation link is followed.
open
boolean
Whether the desktop sidebar is shown, when controlled.
defaultOpen
boolean = true
onOpenChange
(open: boolean) => void
Called when the trigger or Ctrl or Command plus B shows or hides the desktop sidebar.
breadcrumb
ShellCrumb[]
Trail in the top bar. Defaults to the workspace followed by the current item.
title
string
Page heading at the top of the main region. Defaults to the current item label.
actions
React.ReactNode
Page level actions at the end of the title row.
user
ShellUser | null = DEFAULT_USER
Account row at the foot of the sidebar. Pass null to leave it out.
usage
ShellUsage | null = DEFAULT_USAGE
Plan usage meter above the account row. Pass null to leave it out.
loading
boolean = false
Shows skeletons in the navigation, top bar and main region while the workspace loads.
headingLevel
HeadingLevel = 1
Rank of the page heading. The shell owns the page, so it defaults to 1.
locale
string = "en-US"

Also accepts every prop of Omit<React.ComponentProps<"div">, "title">.

Accessibility

Keyboard
Keyboard support for App Shell with Inset Sidebar
KeyEffect
TabMoves through the skip link, workspace link, navigation, plan link, account link, sidebar trigger, breadcrumb and then the page. On a narrow screen the sidebar links are reached inside the sheet
Enter on Skip to contentMoves focus to the main region
Ctrl+B or Command+BShows or hides the sidebar, or opens and closes the sheet on a narrow screen. Opening the sheet moves focus to its Close sidebar button
Enter or Space on the triggerShows or hides the sidebar. A hidden sidebar leaves the tab order, and focus that was inside it moves to the trigger
Enter on a navigation linkFollows the link, marks it as the current page and closes the sheet on a narrow screen. A click with a modifier key only opens the link
Enter or Space on Close sidebarCloses the sheet on a narrow screen and returns focus to the trigger
EscCloses the sheet and returns focus to the trigger, or dismisses the trigger tooltip
Screen reader

Banner, navigation labelled Main and a main region labelled by the page heading, with a skip link first. As the page frame it renders main itself. The trigger reports aria-expanded, and the narrow sidebar is a modal dialog.

  • Announces: Sidebar shown.
  • Announces: Sidebar hidden.
  • Announces: Loading workspace.
Reduced motion
The desktop sidebar shows and hides with no slide. The narrow sheet keeps the host sheet primitive's own short fade and slide.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies9

  • breadcrumb
  • button
  • kbd
  • separator
  • sidebar
  • tooltip
  • @hazine/heading
  • @hazine/use-controllable-state
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

More in App Shells and Dashboards