Are you an LLM? You can read better optimized documentation at /airlib/material-css/layout/navigation-bar.md for this page in Markdown format
Navigation Bar
Navigation bars offer a persistent and convenient way to switch between primary destinations in an app, typically on mobile devices.
Theme Variables
You can customize the standard height of the navigation bar by overriding its CSS variable.
css
:root {
--air-nav-bar-height: calc(var(--spacing) * 20); /* 80px default */
}Composed Utilities
The following composed utilities automatically handle the layout, fixed positioning, typography, and complex interactive states (hover/focus/active) for the icon containers based on the [aria-selected="true"] attribute.
html
<!-- Fixed to the bottom of the screen -->
<nav class="navigation-bar">
<!-- Selected Item -->
<button class="navigation-bar-item" aria-selected="true">
<div class="nav-icon-container">
<span class="material-symbols-outlined material-fill">home</span>
</div>
<span>Home</span>
</button>
<!-- Unselected Item -->
<button class="navigation-bar-item" aria-selected="false">
<div class="nav-icon-container">
<span class="material-symbols-outlined">search</span>
</div>
<span>Search</span>
</button>
</nav>Bar and Item Layout
navigation-bar: Applied to the main wrapper (<nav>). It fixes the bar to the bottom of the screen (z-fixed), establishes a flex layout that evenly spaces items (justify-evenly), and applies asurface-containerbackground.navigation-bar-item: Applied to the interactive elements (e.g.,<button>or<a>). It establishes a column flex layout, applieslabel-mediumtypography, and useson-surface-varianttext color by default. When the[aria-selected="true"]attribute is present, the text color shifts toon-surface.
Icon Container
nav-icon-container: Applied to a<div>wrapping the icon. This utility works dynamically with its parentnavigation-bar-itemto apply Material 3 state layers:- Unselected: Transparent background. Hover and focus states apply subtle
on-surface-variantcolor mixes. - Selected: Automatically applies a pill-shaped
secondary-containerbackground withon-secondary-containericon color when the parentnavigation-bar-itemhas[aria-selected="true"]. Hover and focus states dynamically adapt usingon-surfacecolor mixes over the secondary container.
- Unselected: Transparent background. Hover and focus states apply subtle