androidx.compose.material3

ModalDrawerSheet

Composable function

A part of ModalNavigationDrawer. See that page for an overview and examples.

Basic

The sheet does not follow the drawer state.

@Composable
fun ModalDrawerSheet(
    modifier: Modifier = Modifier,
    drawerShape: Shape = DrawerDefaults.shape,
    drawerContainerColor: Color = DrawerDefaults.modalContainerColor,
    drawerContentColor: Color = contentColorFor(drawerContainerColor),
    drawerTonalElevation: Dp = DrawerDefaults.ModalDrawerElevation,
    windowInsets: WindowInsets = DrawerDefaults.windowInsets,
    content: @Composable ColumnScope.() -> Unit,
)

drawerShape: ShapeOptional

Default: DrawerDefaults.shape

Sets the outline of the sheet.

drawerContainerColor: ColorOptional

Default: DrawerDefaults.modalContainerColor

The background color of the sheet.

drawerContentColor: ColorOptional

Default: contentColorFor(drawerContainerColor)

The default color for text and icons in the sheet.

drawerTonalElevation: DpOptional

Default: DrawerDefaults.ModalDrawerElevation

Tints the sheet a little toward the primary color.

windowInsets: WindowInsetsOptional

Default: DrawerDefaults.windowInsets

Space kept free for system bars inside the sheet.

content: @Composable ColumnScope.() -> UnitRequired

The screen behind the drawer. For a sheet, the items inside it, placed in a Column.

Same as in ModalNavigationDrawer: modifier.

With drawer state

Takes drawerState, for predictive back on Android.

@Composable
fun ModalDrawerSheet(
    drawerState: DrawerState,
    modifier: Modifier = Modifier,
    drawerShape: Shape = DrawerDefaults.shape,
    drawerContainerColor: Color = DrawerDefaults.modalContainerColor,
    drawerContentColor: Color = contentColorFor(drawerContainerColor),
    drawerTonalElevation: Dp = DrawerDefaults.ModalDrawerElevation,
    windowInsets: WindowInsets = DrawerDefaults.windowInsets,
    content: @Composable ColumnScope.() -> Unit,
)

Same as in ModalNavigationDrawer: drawerState, modifier.

Same as above: drawerShape, drawerContainerColor, drawerContentColor, drawerTonalElevation, windowInsets, content.

Drawer types and parts