Navigation rail lets people switch between UI views on mid-sized devices. There are two types of navigation rail.

Note: Images use various dynamic color schemes.
Collapsed and expanded navigation rail elements:
More details on anatomy items in the component guidelines.
Before you can use Material3Expressive component styles, follow the
Material3Expressive themes setup instructions.
The collapsed and expanded navigation rails match visually and can transition
into each other
The navigation rail can now be expanded to show more content, functioning similarly to a navigation drawer. When not expanded, it is referred to as a collapsed navigation rail, which is its default state.
The expanded nav rail is meant to replace the navigation drawer. More on M3 Expressive
Types and naming:
Configurations:
Color:
Measurement changes from M3:
The default style for navigation rail is:
<item name="navigationRailStyle">@style/Widget.Material3Expressive.NavigationRailView</item>
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Color | app:backgroundTint |
N/A | ?attr/colorSurface |
| Elevation | app:elevation |
setElevation |
0dp |
| Fits system windows | android:fitsSystemWindows |
getFitsSystemWindowssetFitsSystemWindows |
true |
| Padding top system window insets | app:paddingTopSystemWindowInsets |
N/A | null |
| Padding bottom system window insets | app:paddingBottomSystemWindowInsets |
N/A | null |
| Top margin | app:contentMarginTop |
N/A | N/A |
| Scrolling | app:scrollingEnabled |
N/A | false |
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Header view | app:headerLayout |
addHeaderViewremoveHeaderViewgetHeaderView |
N/A |
| Header bottom margin | app:headerMarginBottom |
N/A | 8dp |
See the FAB documentation for more attributes.
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Menu gravity | app:menuGravity |
setMenuGravitygetMenuGravity |
TOP\|CENTER_HORIZONTAL |
| Dividers | app:submenuDividersEnabled |
setSubmenuDividersEnabledgetSubmenuDividersEnabled |
false |
Note: If dividers are enabled, they will be between all submenus, which are only visible when expanded.
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Menu resource | app:menu |
inflateMenugetMenu |
N/A |
| Ripple (inactive) | app:itemRippleColor |
setItemRippleColorgetItemRippleColor |
?attr/colorPrimary at 12% (see all states) |
| Ripple (active) | app:itemRippleColor |
setItemRippleColorgetItemRippleColor |
?attr/colorPrimary at 12% (see all states) |
| Label visibility mode | app:labelVisibilityMode |
setLabelVisibilityModegetLabelVisibilityMode |
LABEL_VISIBILITY_AUTO |
| Item minimum height | app:itemMinHeight |
setItemMinimumHeightgetItemMinimumHeight |
NO_ITEM_MINIMUM_HEIGHT |
| Collapsed item minimum height | app:collapsedItemMinHeight |
setCollapsedItemMinimumHeightgetCollapsedItemMinimumHeight |
NO_ITEM_MINIMUM_HEIGHT |
| Expanded item minimum height | app:expandedItemMinHeight |
setExpandedItemMinimumHeightgetExpandedItemMinimumHeight |
NO_ITEM_MINIMUM_HEIGHT |
| Item spacing | app:itemSpacing |
setItemSpacinggetItemSpacing |
0dp |
| Item Gravity | app:itemGravity |
setItemGravitygetItemGravity |
TOP_CENTER |
Note: If there’s not enough room, itemMinHeight and itemSpacing may not
be respected in order to fit the items.
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Color | android:color |
setItemActiveIndicatorColorgetItemActiveIndicatorColor |
?attr/colorSecondaryContainer |
| Width | android:width |
setItemActiveIndicatorWidthgetItemActiveIndicatorWidth |
56dp |
| Height | android:height |
setItemActiveIndicatorHeightgetItemActiveIndicatorHeight |
32dp |
| Shape | app:shapeAppearance |
setItemActiveIndicatorShapeAppearancegetItemActiveIndicatorShapeAppearance |
50% rounded |
| Margin horizontal | app:marginHorizontal |
setItemActiveIndicatorMarginHorizontalgetItemActiveIndicatorMarginHorizontal |
4dp |
| Padding between indicator and label | app:activeIndicatorLabelPadding |
setActiveIndicatorLabelPadding getActiveIndicatorLabelPadding |
4dp |
| Expanded Width | app:expandedWidth |
setItemActiveIndicatorExpandedWidthgetItemActiveIndicatorExpandedWidth |
HUG |
| Expanded Height | app:expandedHeight |
setItemActiveIndicatorExpandedHeightgetItemActiveIndicatorExpandedHeight |
56dp |
| Expanded Margin horizontal | app:expandedMarginHorizontal |
setItemActiveIndicatorExpandedMarginHorizontalgetItemActiveIndicatorExpandedMarginHorizontal |
20dp |
| Expanded Start Padding | app:expandedActiveIndicatorPaddingStart |
setItemExpandedActiveIndicatorPadding |
16dp |
| Expanded End Padding | app:expandedActiveIndicatorPaddingEnd |
setItemExpandedActiveIndicatorPadding |
16dp |
| Expanded Top Padding | app:expandedActiveIndicatorPaddingTop |
setItemExpandedActiveIndicatorPadding |
16dp |
| Expanded Bottom Padding | app:expandedActiveIndicatorPaddingBottom |
setItemExpandedActiveIndicatorPadding |
16dp |
Note: The expanded active indicator refers to the active indicator that
expands to wrap the content of the navigation rail item when the
itemIconGravity value is equal to START.
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Icon | android:icon in the menu resource |
N/A | N/A |
| Size | app:itemIconSize |
setItemIconSizesetItemIconSizeResgetItemIconSize |
24dp |
| Color (inactive) | app:itemIconTint |
setItemIconTintListgetItemIconTintList |
?attr/colorOnSurfaceVariant |
| Color (active) | app:itemIconTint |
setItemIconTintListgetItemIconTintList |
?attr/colorOnSecondaryContainer |
| Gravity | app:itemIconGravity |
setItemIconGravitygetItemIconGravity |
TOP |
| Icon label horizontal padding | app:iconLabelHorizontalSpacing |
setIconLabelHorizontalSpacinggetIconLabelHorizontalSpacing |
8dp |
| Element | Attribute | Related methods | Default value |
|---|---|---|---|
| Text label | android:title in the menu resource |
N/A | N/A |
| Color (inactive) | app:itemTextColor |
setItemTextColorgetItemTextColor |
?attr/colorOnSurfaceVariant |
| Color (active) | app:itemTextColor |
setItemTextColorgetItemTextColor |
?attr/colorOnSurface |
| Typography (inactive) | app:itemTextAppearanceInactiveapp:horizontalItemTextAppearanceInactive |
setItemTextAppearanceInactivegetItemTextAppearanceInactivesetHorizontalItemTextAppearanceInactivegetHorizontalItemTextAppearanceInactive |
?attr/textAppearanceTitleSmall for regular item configuration, ?attr/textAppearanceLabelLarge for horizontal |
| Typography (active) | app:itemTextAppearanceActiveapp:horizontalItemTextAppearanceActive |
setItemTextAppearanceActivegetItemTextAppearanceActivesetHorizontalItemTextAppearanceActivegetHorizontalItemTextAppearanceActive |
?attr/textAppearanceTitleSmall for regular item configuration, ?attr/textAppearanceLabelLarge for horizontal |
| Typography (active) | app:itemTextAppearanceActiveBoldEnabled |
setItemTextAppearanceActiveBoldEnabled |
true |
| Max lines | app:labelMaxLines |
setLabelMaxLinesgetLabelMaxLines |
1 |
| Scale with font size | app:scaleLabelWithFontSize |
setScaleLabelTextWithFontgetScaleLabelTextWithFont |
false |
| Element | Style | Container color | Icon/Text label color (inactive) | Icon/Text label color (active) | Theme attribute |
|---|---|---|---|---|---|
| Default style | Widget.Material3.NavigationRailView |
?attr/colorSurface |
?attr/colorOnSurfaceVariant |
?attr/colorOnSurface?attr/colorOnSecondaryContainer |
?attr/navigationRailStyle |
For the full list, see styles, navigation bar attributes, and navigation rail attributes.
Before you can use the Material navigation rail, you need to add a dependency to the Material components for Android library. For more information, go to the Getting started page.
* Alarms
* Schedule
* Timers
* Stopwatch
In `navigation_rail_menu.xml` inside a `menu` resource directory:
```xml
|
```xml
Navigation rail supports the customization of color and typography.
API and source code:
NavigationRailView
The following example shows a navigation rail with Material theming.

Use theme attributes and a style in res/values/styles.xml which apply to all
navigation rails and affect other components:
<style name="Theme.App" parent="Theme.Material3.*">
...
<item name="colorPrimary">@color/shrine_theme_light_primary</item>
<item name="colorSecondaryContainer">@color/shrine_theme_light_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/shrine_theme_light_onSecondaryContainer</item>
<item name="colorTertiaryContainer">@color/shrine_theme_light_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/shrine_theme_light_onTertiaryContainer</item>
<item name="colorError">@color/shrine_theme_light_error</item>
<item name="colorErrorContainer">@color/shrine_theme_light_errorContainer</item>
<item name="colorOnError">@color/shrine_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/shrine_theme_light_onErrorContainer</item>
<item name="colorSurface">@color/shrine_theme_light_surface</item>
<item name="colorOnSurface">@color/shrine_theme_light_onSurface</item>
<item name="colorOnSurfaceVariant">@color/shrine_theme_light_onSurfaceVariant</item>
</style>
Use a default style theme attribute, styles, and a theme overlay, which apply to all navigation rails but do not affect other components:
<style name="Theme.App" parent="Theme.Material3.*">
...
<item name="navigationRailStyle">@style/Widget.App.NavigationRailView</item>
</style>
<style name="Widget.App.NavigationRailView" parent="Widget.Material3.NavigationRailView">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.NavigationRailView</item>
</style>
<style name="ThemeOverlay.App.NavigationRailView" parent="">
<item name="colorPrimary">@color/shrine_theme_light_primary</item>
<item name="colorSecondaryContainer">@color/shrine_theme_light_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/shrine_theme_light_onSecondaryContainer</item>
<item name="colorTertiaryContainer">@color/shrine_theme_light_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/shrine_theme_light_onTertiaryContainer</item>
<item name="colorError">@color/shrine_theme_light_error</item>
<item name="colorErrorContainer">@color/shrine_theme_light_errorContainer</item>
<item name="colorOnError">@color/shrine_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/shrine_theme_light_onErrorContainer</item>
<item name="colorSurface">@color/shrine_theme_light_surface</item>
<item name="colorOnSurface">@color/shrine_theme_light_onSurface</item>
<item name="colorOnSurfaceVariant">@color/shrine_theme_light_onSurfaceVariant</item>
</style>
Or use the style in the layout, which affects only this specific navigation rail bar:
<com.google.android.material.navigationrail.NavigationRailView
...
style="@style/Widget.App.NavigationRailView"
/>