Mobile Navbar Component

The **Mobile Navbar** component in Axiom01 provides a responsive, accessible navigation solution for smaller screens. It transforms a standard desktop navigation into a toggleable menu, ensuring a consistent user experience across all devices.

Live Example

To best experience the mobile navbar, please view this page on a smaller screen or use your browser's developer tools to simulate a mobile viewport.

Axiom01

Scroll down to see content behind the fixed header.

Usage Guidelines

To implement the Mobile Navbar, use the following semantic HTML structure within your main site header:

JavaScript Integration

The mobile navbar's interactive behavior (toggling the menu open/closed) is handled by js/components/mobile-navbar.js. This script:

Additionally, the component now returns a destroy() method. This method cleans up event listeners and resets ARIA attributes, preventing memory leaks when the mobile navbar is dynamically removed from the DOM or when a page transition occurs in a Single Page Application (SPA).

Accessibility

Axiom01's Mobile Navbar is built with accessibility in mind:

Customization

You can customize the Mobile Navbar's appearance by overriding the following CSS variables in your site.css or a custom theme file. Most of the styling is applied directly to header.main and its descendants in css/axiom.css.

Code Example

<header class="main" data-component="mobile-navbar">
<a href="#" class="brand">Your Logo</a>
<div class="actions">
    <button class="menu toggle" aria-label="Toggle navigation" aria-expanded="false" aria-controls="[auto-generated-id]">
        <i class="fas fa-bars" aria-hidden="true"></i>
    </button>
</div>
<nav>
    <ul class="links" aria-hidden="true" aria-labelledby="[auto-generated-id]">
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
    </ul>
</nav>
</header>