A modern, responsive navigation menu component with cascading mega menu for desktop and multi-level accordion for mobile devices.
- 4-Panel Cascading Mega Menu: Progressive hover-based navigation
- Static promotional panel
- Submenu items panel
- Subcategories panel
- Final items panel
- Smooth hover transitions and visual feedback
- Dynamic content loading from JSON data
- 5-Level Accordion Menu: Touch-friendly collapsible navigation
- Slide-in panel from right
- Expandable/collapsible sections at each level
- Smooth animations
- Click outside to close
- Hamburger menu toggle
- Responsive breakpoints (lg: 1024px)
- Centralized navigation data in JSON format
- Automatic filtering by status
- Sorted by index for consistent ordering
- Supports unlimited nesting levels
- React - UI framework
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- React Icons - Icon library (Feather Icons)
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run buildsrc/
├── components/
│ ├── Navbar.jsx # Main navigation component
│ ├── MegaMenu.jsx # Desktop mega menu
│ └── MobileMenu.jsx # Mobile accordion menu
├── hooks/
│ └── useNavbar.js # Data transformation hook
├── data/
│ └── navbarData.json # Navigation menu data
└── main.jsx
The navigation data follows a 4-level hierarchy:
{
"name": "Services",
"submenu": [
{
"name": "Web & Software Development",
"subcategories": [
{
"name": "Business & Enterprise",
"items": [{ "name": "ERP Software", "slug": "erp-software" }]
}
]
}
]
}- Modify Tailwind classes in component files
- Adjust breakpoints for responsive behavior
- Edit
src/data/navbarData.jsonto update menu items - Add/remove levels as needed
- Set
status: falseto hide items
- Adjust column spans in MegaMenu.jsx for desktop layout
- Modify panel widths in MobileMenu.jsx for mobile layout
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Responsive design for all screen sizes
MIT
Contributions are welcome! Please feel free to submit a Pull Request.