androidx.compose.material3
ModalBottomSheetExperimental
Composable function
A bottom sheet slides up from the bottom and shows extra content or actions.
ModalBottomSheetcovers the screen with a dim layer. The user must close it to go on. Use it for a list of actions, like "Share with".BottomSheetScaffoldkeeps a sheet at the bottom of a screen, partly visible. The user can drag it up. Use it for content that belongs with the screen, like a map's list of places.

// The Box only gives the picture a size. In an app, show the sheet when a state is true.
Box(Modifier.size(360.dp, 420.dp)) {
ModalBottomSheet(onDismissRequest = {}) {
Column(Modifier.padding(horizontal = 16.dp).padding(bottom = 24.dp)) {
Text("Share with")
Spacer(Modifier.height(8.dp))
listOf("Email" to Icons.Filled.Email, "Messages" to Icons.Filled.Share).forEach { (label, icon) ->
NavigationDrawerItem(
label = { Text(label) },
icon = { Icon(icon, null) },
selected = false,
onClick = {},
)
}
}
}
}
BottomSheet is the sheet on its own, without a scaffold or dim layer, for your own layouts.
A modal sheet is shown while it is in the composition. Keep a Boolean state and wrap it in if (showSheet) { ... }.
To close it with an animation, call sheetState.hide() from a coroutine, then set your state to false.
ParametersExperimental
@Composable
fun ModalBottomSheet(
onDismissRequest: () -> Unit,
modifier: Modifier = Modifier,
sheetState: SheetState = rememberBottomSheetState(initialValue = Hidden),
sheetMaxWidth: Dp = BottomSheetDefaults.SheetMaxWidth,
sheetGesturesEnabled: Boolean = true,
shape: Shape = BottomSheetDefaults.ExpandedShape,
containerColor: Color = BottomSheetDefaults.ContainerColor,
contentColor: Color = contentColorFor(containerColor),
tonalElevation: Dp = 0.dp,
scrimColor: Color = BottomSheetDefaults.ScrimColor,
dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() },
contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.modalWindowInsets },
properties: ModalBottomSheetProperties = ModalBottomSheetProperties(),
content: @Composable ColumnScope.() -> Unit,
)
onDismissRequest: () -> UnitRequired
onDismissRequest: () -> UnitRequiredCalled when the user swipes the sheet down, taps outside, or presses back. Set your state to false here.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
sheetState: SheetStateOptional
sheetState: SheetStateOptionalDefault: rememberBottomSheetState(initialValue = Hidden)
Controls and reads the position of the sheet: hidden, partly open or fully open.
Create it with rememberBottomSheetState(...).
sheetMaxWidth: DpOptional
sheetMaxWidth: DpOptionalDefault: BottomSheetDefaults.SheetMaxWidth
The widest the sheet can be. On wide screens it is centered.
sheetGesturesEnabled: BooleanOptionalSince 1.9
sheetGesturesEnabled: BooleanOptionalSince 1.9Default: true
Set to false to stop the user from dragging the sheet.
shape: ShapeOptional
shape: ShapeOptionalDefault: BottomSheetDefaults.ExpandedShape
Sets the outline. Default: rounded top corners.
containerColor: ColorOptional
containerColor: ColorOptionalDefault: BottomSheetDefaults.ContainerColor
The background color.
contentColor: ColorOptional
contentColor: ColorOptionalDefault: contentColorFor(containerColor)
The default color for text and icons inside.
tonalElevation: DpOptional
tonalElevation: DpOptionalDefault: 0.dp
Tints the background a little toward the primary color.
scrimColor: ColorOptional
scrimColor: ColorOptionalDefault: BottomSheetDefaults.ScrimColor
The color of the dim layer behind a modal sheet.
dragHandle: @Composable (() -> Unit)?Optional
dragHandle: @Composable (() -> Unit)?OptionalDefault: { BottomSheetDefaults.DragHandle() }
The small bar at the top that shows the sheet can be dragged. Pass null to hide it.
contentWindowInsets: @Composable () -> WindowInsetsOptional
contentWindowInsets: @Composable () -> WindowInsetsOptionalDefault: { BottomSheetDefaults.modalWindowInsets }
Space kept free for system bars inside the sheet.
properties: ModalBottomSheetPropertiesOptional
properties: ModalBottomSheetPropertiesOptionalDefault: ModalBottomSheetProperties()
Window options for the modal sheet, like whether back closes it.
content: @Composable ColumnScope.() -> UnitRequired
content: @Composable ColumnScope.() -> UnitRequiredWhat the sheet shows. Items are placed in a Column.
Bottom sheet types
ModalBottomSheetBottomSheetScaffoldBottomSheet
See also
ModalBottomSheetDefaults: default values and helper functions forModalBottomSheet.