sabo/src/components/dashboard/app-sidebar.tsx
When to use
- Provide persistent navigation inside the protected dashboard area.
Usage
src/app/(dashboard)/dashboard/layout.tsx
Structure
The sidebar composes several nav components:nav-main.tsx- Primary navigation items (with collapsible sub-items)nav-secondary.tsx- Secondary links (Support, Feedback, etc.)nav-user.tsx- User dropdown in footernav-projects.tsx- Optional projects listteam-switcher.tsx- Team/project selector in header
Key features
- Collapsible: Sidebar collapses to icon-only mode (
collapsible="icon") - Active state tracking: Uses
usePathname()to highlight current section - Composed navigation: Built from multiple nav components (NavMain, NavProjects, NavSecondary, NavUser)
- Team switcher: Placed in
SidebarHeaderfor context switching
Customization
1
Edit menu items
Open
app-sidebar.tsx and edit the navMain array. Each item can have nested sub-items.2
Active state highlighting
Use
usePathname() to compute active state for each nav section:3
Customize sections
Modify the data arrays for different nav sections:
navMain- Primary navigation with collapsible sub-itemsnavSecondary- Secondary links (Support, Feedback)projects- Project/workspace quick linksteams- Team switcher options
4
External links
For external URLs, set the
url field to a full URL (e.g., https://docs.example.com). The nav components will render them appropriately.Troubleshooting
- Sidebar not collapsing on mobile
- Ensure
SidebarProviderwraps the entire layout
- Ensure
- Active state not updating
- Verify
usePathname()is being called andisActiveis set correctly
- Verify
- Icons not showing
- Import icons from
lucide-reactand ensure they’re passed as components, not strings
- Import icons from