Are you an LLM? You can read better optimized documentation at /airlib/material-css/layout/navigation-rail.md for this page in Markdown format
Navigation Rail
Navigation rails provide access to primary destinations in apps when using tablet and desktop screens. They are positioned vertically on the left edge of the screen.
Theme Variables
You can customize the standard width of the navigation rail by overriding its CSS variable.
css
:root {
--air-nav-rail-width: calc(var(--spacing) * 20); /* 80px default */
}Composed Utilities
The navigation rail utilizes a similar HTML structure to the navigation bar but is optimized for a vertical, fixed-left layout with slightly wider hover targets.
html
<!-- Fixed to the left of the screen -->
<nav class="navigation-rail">
<!-- Selected Item -->
<button class="navigation-rail-item" aria-selected="true">
<div class="nav-rail-icon-container">
<span class="material-symbols-outlined material-fill">home</span>
</div>
<span>Home</span>
</button>
<!-- Unselected Item -->
<button class="navigation-rail-item" aria-selected="false">
<div class="nav-rail-icon-container">
<span class="material-symbols-outlined">search</span>
</div>
<span>Search</span>
</button>
</nav>Rail and Item Layout
navigation-rail: Applied to the main wrapper (<nav>). It fixes the rail to the left edge of the screen (z-fixed), establishes a column flex layout, applies asurfacebackground color, and adds a vertical border to the right side using theoutline-variantcolor.navigation-rail-item: Applied to the interactive elements (e.g.,<button>). It establishes a column flex layout, applieslabel-mediumtypography, and useson-surface-varianttext color. When the[aria-selected="true"]attribute is present, the text color shifts toon-surface.
Icon Container
nav-rail-icon-container: Applied to a<div>wrapping the icon. Just like the navigation bar, this container dynamically handles Material 3 state layers based on its parentnavigation-rail-item:- 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 parent has[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