State of Compose 2023 results are in! Click here to learn more

← Back to Material 3 Compose

NavigationDrawer

Component
in
Material 3
. Since 1.0.0-alpha01

Overview

Code Examples

!Navigation drawer image(https://developer.android.com/images/reference/androidx/compose/material3/navigation-drawer.png)

Material Design navigation drawer.

Modal navigation drawers block interaction with the rest of an app’s content with a scrim. They are elevated above most of the app’s UI and don’t affect the screen’s layout grid.

Overloads

@Composable
@ExperimentalMaterial3Api
fun NavigationDrawer(
    drawerContent: @Composable ColumnScope.() -> Unit,
    modifier: Modifier = Modifier,
    drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),
    gesturesEnabled: Boolean = true,
    drawerShape: Shape = RoundedCornerShape(0.dp, 16.dp, 16.dp, 0.dp),
    drawerTonalElevation: Dp = DrawerDefaults.Elevation,
    drawerContainerColor: Color = NavigationDrawerTokens.ContainerColor.toColor(),
    drawerContentColor: Color = contentColorFor(drawerContainerColor),
    scrimColor: Color = DrawerDefaults.scrimColor,
    content: @Composable () -> Unit
)

Parameters

NameDescription
drawerContentcomposable that represents content inside the drawer
modifieroptional modifier for the drawer
drawerStatestate of the drawer
gesturesEnabledwhether or not drawer can be interacted by gestures
drawerShapeshape of the drawer sheet
drawerTonalElevationAffects the alpha of the color overlay applied on the container color of the drawer sheet.
drawerContainerColorcontainer color to be used for the drawer sheet
drawerContentColorcolor of the content to use inside the drawer sheet. Defaults to either the matching content color for drawerContainerColor, or, if it is not a color from the theme, this will keep the same value set above this Surface.
scrimColorcolor of the scrim that obscures content when the drawer is open
contentcontent of the rest of the UI @throws IllegalStateException when parent has Float.POSITIVE_INFINITY widt