Skip to content

Catalog Menu

The Catalog Menu component provides a vertical navigation menu with expandable content areas. It’s designed for displaying categorized content with icons and hover-activated content panels, making it ideal for e-commerce catalogs, product categories, or hierarchical navigation systems.

<nav data-role="catalog-menu">
<ul>
<li>
<a href="#category1">
<img src="icon1.svg" class="icon" loading="lazy">
Category 1
</a>
<div class="catalog-item-content">
Content for Category 1
</div>
</li>
<li>
<a href="#category2">
<img src="icon2.svg" class="icon" loading="lazy">
Category 2
</a>
<div class="catalog-item-content">
Content for Category 2
</div>
</li>
</ul>
</nav>
const catalogMenu = Metro.makePlugin("#myCatalogMenu", "catalog-menu");
ParameterTypeDefaultDescription
onCatalogCreatefunctionMetro.noopCallback function triggered when the catalog menu is created

Removes the catalog menu element from the DOM and cleans up event listeners.

const catalogMenu = Metro.getPlugin('#myCatalogMenu', 'catalog-menu');
catalogMenu.destroy();
EventDescription
catalog-createTriggered when the catalog menu component is created
Metro.catalogMenuSetup({
onCatalogCreate: function() {
console.log('Catalog menu has been created');
}
});

You can set up global configuration for all catalog menu components:

Metro.catalogMenuSetup({
toggle: ".default-toggle",
onCatalogCreate: function() {
console.log('Catalog menu created');
}
});
VariableDefault (Light)Dark ModeDescription
--catalog-menu-width272px272pxWidth of the catalog menu
--catalog-menu-background#ffffff#2b2d30Background color of the menu
--catalog-menu-color#191919#f3fcffText color of the menu
--catalog-menu-border-color#c5c5c5#2b2d30Border color of the menu
--catalog-menu-item-background-hover#e8e8e8#1e1f22Background color of menu items on hover
--catalog-menu-item-color-hover#000000#ffffffText color of menu items on hover
--catalog-menu-chevronSVG chevron (gray)SVG chevron (light gray)Chevron icon for menu items
/* Custom styling example */
#my-catalog-menu {
--catalog-menu-width: 300px;
--catalog-menu-background: #f8f9fa;
--catalog-menu-color: #333333;
--catalog-menu-item-background-hover: #007bff;
--catalog-menu-item-color-hover: #ffffff;
}
  • .catalog-menu - Main container class (automatically applied)
  • .catalog-list - List container for catalog items
  • .catalog-item - Individual catalog item
  • .catalog-item-content - Content area that appears on hover
  • .menu-active - Applied when menu is toggled active (when using toggle functionality)

The catalog menu expects a specific HTML structure:

<nav data-role="catalog-menu">
<ul>
<li>
<a href="#">
<img src="icon.svg" class="icon" loading="lazy">
<!-- or use Metro icons -->
<span class="icon mif-icon-name"></span>
Item Text
</a>
<div class="catalog-item-content">
<!-- Content that appears on hover -->
<p>Additional content goes here</p>
</div>
</li>
</ul>
</nav>

or with item class definition:

<nav data-role="catalog-menu">
<ul class="catalog-list">
<li class="catalog-item">
<a href="#">
<img src="icon.svg" class="icon" loading="lazy">
<!-- or use Metro icons -->
<span class="icon mif-icon-name"></span>
Item Text
</a>
<div class="catalog-item-content">
<!-- Content that appears on hover -->
<p>Additional content goes here</p>
</div>
</li>
</ul>
</nav>
  • Responsive Design: Automatically adjusts content width based on parent container
  • Hover Activation: Content panels appear on hover (on devices that support hover)
  • Toggle Functionality: Optional toggle button to show/hide the entire menu
  • Icon Support: Supports both image icons and Metro icon fonts
  • Theme Support: Built-in support for light and dark themes
  • Accessibility: Proper semantic HTML structure with navigation elements
  • Use semantic HTML with <nav> element for better accessibility
  • Include meaningful href attributes in anchor tags for proper navigation
  • Use appropriate alt attributes for image icons
  • Consider using loading="lazy" for image icons to improve performance
  • Ensure content in .catalog-item-content is meaningful and provides value to users
  • Test hover functionality on touch devices and provide alternative interaction methods if needed
  • The component automatically calculates and adjusts the content width based on the parent container size
  • Window resize events are handled automatically to maintain proper responsive behavior
  • The chevron indicator is purely decorative and implemented via CSS
  • Content panels are positioned absolutely and may require container positioning context for proper display