AppSidebar
src/lib/components/AppSidebar.svelte
Purpose
The left navigation rail for the authenticated shell. It renders the
SidebarOrgSwitcher in the header, the SidebarModuleSwitcher plus the current
module's nav links in the content, and the SidebarProfileMenu,
SidebarHealthBadge, and SidebarVersionBadge in the footer. Nav links are
driven by shellNav.moduleNav and support two-level collapsible groups with
active-route highlighting. On afterNavigate it persists the last route, and an
$effect keeps the selected module in sync with the current pathname.
Origin
Custom — Primebrick-written, built on the shadcn-svelte™ Sidebar primitive
and composing five custom Sidebar* subcomponents plus DynamicIcon.
Usage
Default (mounted by AppShell)
Code
Collapsible icon mode
The sidebar uses collapsible="icon". When collapsed, group parents expand the
rail on click instead of toggling, and labels hide via
group-data-[collapsible=icon] utilities.
Code
Logout handling
AppSidebar owns the logout flow (clears tokens, session storage, redirects to
/login) and passes it down as onLogout to SidebarProfileMenu.
Code
Props
Full prop table: see API reference — appsidebar.
Key props: none — AppSidebar takes no props; it reads state from shellNav,
userProfileState, and the Sidebar.useSidebar() context.