Overview
TheAdminSidebar component provides the main navigation sidebar for the PROVESA admin panel. It features a glass-morphism design, active tab highlighting, user profile display, and logout functionality.
Import
Props
Array of navigation item objects that define the sidebar menu.NavItem Structure:
Currently active tab name. This prop is bindable, so changes in the sidebar will update the parent component.Example:
User information object for the profile section.User Structure:If not provided or if
name is missing, defaults to “Administrador”.Usage
Basic Usage
Complete Admin Panel Example
Component Structure
Logo Section
Displays the PROVESA logo at the top:Navigation Items
Scrollable navigation menu in the middle:User Profile Section
Fixed at the bottom with logout button:User Initials
The avatar displays user initials derived from the name:- “Juan Pérez” → “JP”
- “María” → “M”
- “José Antonio López” → “JA”
- No user → “AD”
Active Tab Styling
The active navigation item receives special styling:Notification Badges
Optional red badges for items needing attention:Glass-Morphism Design
The sidebar uses a glass effect:Scrollable Navigation
The navigation area is scrollable with hidden scrollbar:Logout Functionality
The logout button submits a form action:use:enhance directive provides progressive enhancement for the form submission.
Positioning
- Fixed to the left side of the viewport
- Full height
- Hidden on screens < 1024px (mobile/tablet)
- Visible on large screens (≥1024px)
Layout Compensation
When using the sidebar, add left padding to main content:lg:pl-72 class adds left padding equal to the sidebar width on large screens.
Material Icons
Requires Material Icons font to be loaded. Common icons used:| Icon Name | Usage |
|---|---|
dashboard | Dashboard/Home |
view_carousel | Sliders |
inventory_2 | Products |
info | About/Info |
web | Footer/Web |
gavel | Legal pages |
emoji_events | Contests |
work | Job applications |
feedback | Suggestions |
settings | Settings |
logout | Logout button |
Accessibility
- Uses semantic HTML with
<aside>and<nav>elements - Button elements for interactive items
- Proper ARIA support through semantic HTML
- Logout button has descriptive
titleattribute - Logo has descriptive
alttext - Truncated text for long user names
Responsive Behavior
- Mobile/Tablet (< 1024px): Hidden completely
- Desktop (≥ 1024px): Visible as fixed sidebar
Dependencies
$app/forms-enhancefor progressive enhancement$lib/assets/images/provesa-logo.png- PROVESA logo- Material Icons font (must be loaded in app)
Related Components
- Admin tabs (DashboardTab, ProductosTab, etc.)
- Navbar - Public site navigation
