Using the Admin Layout

The admin panel provides a complete layout system with Sidebar, Navbar, and MainLayout components.

Quick Start

Basic Usage

Full Configuration

Components

MainLayout

The main wrapper that combines Sidebar and Navbar. Props: Left navigation panel with company logo, nav items, and footer actions. Features:
  • ✅ Glassmorphism design
  • ✅ Active route highlighting
  • ✅ Section headers
  • ✅ Badge support
  • ✅ Settings and logout actions
  • ✅ Mobile responsive (hiddenon mobile)
Icons Used (from solid-icons):
  • TbDashboard - Dashboard
  • TbUsers - Employees
  • TbCalendarEvent - Leave Requests
  • TbCalendar - Calendar
  • TbChartBar - Reports
  • TbUserGroup - Users
  • TbSettings - Settings
  • TbLogout - Logout
  • TbLeaf - Company logo
Top navigation bar with search, dark mode toggle, notifications, and user profile. Features:
  • ✅ Glassmorphism design
  • ✅ Search bar
  • ✅ Dark mode toggle
  • ✅ Notification bell with badge
  • ✅ User profile with avatar/initials
  • ✅ Mobile menu button
  • ✅ Responsive design
Icons Used (from solid-icons):
  • TbSearch - Search
  • TbMoon / TbSun - Dark mode
  • TbBell - Notifications
  • TbMenu2 - Mobile menu

Default Navigation

The Sidebar comes with default navigation:

Custom Navigation

Pass custom navigation sections:

Adding Badges

Show notification counts on nav items:

User Profile

With Avatar

Without Avatar (Shows Initials)

Dark Mode

The dark mode toggle is built into the Navbar. It:
  • ✅ Toggles dark class on document.documentElement
  • ✅ Shows moon icon in light mode
  • ✅ Shows sun icon in dark mode
  • ✅ Smooth transitions
To persist dark mode preference:

Mobile Behavior

  • Desktop (md breakpoint and up): Always visible
  • Mobile: Hidden by default, shown when menu button clicked
  • Overlay: Dark backdrop with blur when sidebar is open
  • Animation: Slides in from left
  • Desktop: Shows search bar
  • Mobile: Shows menu button, hides search
  • User Profile: Shows name and role on large screens only

Page Content Area

The content area inside MainLayout:
  • ✅ Automatically scrollable
  • ✅ Custom scrollbar styling
  • ✅ Proper spacing and padding
  • ✅ Full height utilization

Example Pages

See /routes/dashboard-example.tsx for a complete example with:
  • MainLayout configuration
  • Stat cards
  • Content sections
  • Proper styling

TypeScript Types