Overview
TheAdminLayout component provides the main layout structure for the admin dashboard. It includes a collapsible sidebar, header, main content area, and footer.
Component Location
Features
- Responsive layout with collapsible sidebar
- Automatic sidebar width adjustment
- Backdrop overlay for mobile navigation
- Slot-based content insertion
- User authentication check on mount
Usage
Template Structure
Composables Used
useSidebar
The layout uses theuseSidebar composable to manage sidebar state:
isExpanded- Boolean indicating if sidebar is expandedisHovered- Boolean indicating if sidebar is being hovered
Lifecycle Hooks
getMe() function from the auth store.
Layout Behavior
Desktop (lg and above)
- Sidebar width:
290px(expanded) or90px(collapsed) - Smooth transition between states
- Hover to temporarily expand collapsed sidebar
Mobile
- Sidebar is hidden by default
- Toggle button in header shows/hides sidebar
- Backdrop overlay when sidebar is open
Styling Classes
Key Tailwind classes used:min-h-screen- Full viewport heightxl:flex- Flex layout on extra-large screenstransition-all duration-300 ease-in-out- Smooth animationslg:ml-[290px]/lg:ml-[90px]- Dynamic margin based on sidebar state
Child Components
- AppSidebar - Navigation sidebar (~/workspace/docs/components/sidebar.mdx:1)
- AppHeader - Top navigation header (~/workspace/docs/components/header.mdx:1)
- Backdrop - Modal backdrop for mobile