Are you an LLM? You can read better optimized documentation at /airlib/material-css/layout/navigation-drawer.md for this page in Markdown format
Navigation Drawer
Navigation drawers provide access to destinations and app functionality, such as switching accounts. They can either slide in temporarily (modal) or persist alongside content.
Theme Variables
You can customize the standard width and border radius of the drawer by overriding its CSS variables.
css
:root {
--air-drawer-width: 22.5rem; /* 360px default */
--air-drawer-radius: var(--radius-lg);
}Composed Utilities
The navigation drawer utilities handle off-screen sliding animations, fixed positioning, and modal scrim overlays out of the box.
Modal Drawer
Modal navigation drawers block interaction with the rest of an app's content with a scrim. They are typically used on mobile screens or smaller windows.
html
<!-- Background Scrim -->
<!-- Toggle data-state="open" via JavaScript to show -->
<div class="drawer-scrim" data-state="open"></div>
<!-- The Drawer -->
<nav class="drawer shadow-3" data-state="open">
<div class="p-4">
<h2 class="title-small">App Name</h2>
</div>
<!-- Add List utilities here for navigation items -->
</nav>drawer: Applied to the main sliding navigation container. It fixes the container to the left side of the screen (z-index: 50), enforces the--air-drawer-width, and applies asurface-container-lowbackground with rounded right corners. By default, it is translated off-screen (translateX(-100%)). Whendata-state="open"is applied, it smoothly translates into view.drawer-scrim: Applied to the backdrop element behind the modal drawer. It fixes to the entire viewport (z-index: 40), remains invisible, and ignores pointer events by default. Whendata-state="open"is applied, it fades in a darkcolor-scrimoverlay and intercepts clicks.
Persistent Drawer
Standard or persistent navigation drawers allow interaction with both the drawer and screen content simultaneously. They are typically used on wider screens (tablets and desktops).
html
<!-- Use the drawer-persistent modifier class -->
<nav class="drawer drawer-persistent">
<div class="p-4">
<h2 class="title-small">App Name</h2>
</div>
<!-- Navigation items -->
</nav>.drawer.drawer-persistent: When thedrawer-persistentmodifier is added to thedrawer, it resets the fixed positioning torelative, removes the border radius, disables the slide transformation (making it always visible), changes the background to the standardsurfacecolor, and adds a vertical border to the right side usingoutline-variant.