Bottom sheets
Stay organized with collections
Save and categorize content based on your preferences.
If you want to implement a bottom sheet, you can use the
ModalBottomSheet
composable.
You can use the content
slot, which uses a ColumnScope
to layout sheet
content composables in a column:
ModalBottomSheet(onDismissRequest = { /* Executed when the sheet is dismissed */ }) {
// Sheet content
}
Control sheet state programmatically
To programmatically expand and collapse the sheet, use
SheetState
. You can use rememberSheetState
to create an instance
of SheetState
that should be passed to ModalBottomSheet
with the
sheetState
parameter. SheetState
provides access to the show
and
hide
functions, as well as properties related to the current sheet
state. These suspending functions require a CoroutineScope
— for example,
using rememberCoroutineScope
— and you can call them in response to UI
events. Make sure to remove the ModalBottomSheet
from composition upon hiding
the bottom sheet.
val sheetState = rememberModalBottomSheetState()
val scope = rememberCoroutineScope()
var showBottomSheet by remember { mutableStateOf(false) }
Scaffold(
floatingActionButton = {
ExtendedFloatingActionButton(
text = { Text("Show bottom sheet") },
icon = { Icon(Icons.Filled.Add, contentDescription = "") },
onClick = {
showBottomSheet = true
}
)
}
) { contentPadding ->
// Screen content
if (showBottomSheet) {
ModalBottomSheet(
onDismissRequest = {
showBottomSheet = false
},
sheetState = sheetState
) {
// Sheet content
Button(onClick = {
scope.launch { sheetState.hide() }.invokeOnCompletion {
if (!sheetState.isVisible) {
showBottomSheet = false
}
}
}) {
Text("Hide bottom sheet")
}
}
}
}
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[],[],null,["# Bottom sheets\n\nIf you want to implement a [bottom sheet](https://m3.material.io/components/bottom-sheets/overview), you can use the\n[`ModalBottomSheet`](/reference/kotlin/androidx/compose/material3/package-summary#ModalBottomSheet(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.material3.SheetState,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,kotlin.Function0,androidx.compose.foundation.layout.WindowInsets,androidx.compose.material3.ModalBottomSheetProperties,kotlin.Function1)) composable.\n\nYou can use the `content` slot, which uses a [`ColumnScope`](/reference/kotlin/androidx/compose/foundation/layout/ColumnScope) to layout sheet\ncontent composables in a column:\n\n\n```kotlin\nModalBottomSheet(onDismissRequest = { /* Executed when the sheet is dismissed */ }) {\n // Sheet content\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt#L364-L366\n```\n\n\u003cbr /\u003e\n\nControl sheet state programmatically\n------------------------------------\n\nTo programmatically expand and collapse the sheet, use\n[`SheetState`](/reference/kotlin/androidx/compose/material3/SheetState). You can use [`rememberSheetState`](/reference/kotlin/androidx/compose/material3/package-summary#rememberSheetState(kotlin.Boolean,kotlin.Function1)) to create an instance\nof `SheetState` that should be passed to `ModalBottomSheet` with the\n`sheetState` parameter. `SheetState` provides access to the [`show`](/reference/kotlin/androidx/compose/material3/SheetState#show()) and\n[`hide`](/reference/kotlin/androidx/compose/material3/SheetState#hide()) functions, as well as properties related to the current sheet\nstate. These suspending functions require a `CoroutineScope` --- for example,\nusing [`rememberCoroutineScope`](/reference/kotlin/androidx/compose/runtime/package-summary#remembercoroutinescope) --- and you can call them in response to UI\nevents. Make sure to remove the `ModalBottomSheet` from composition upon hiding\nthe bottom sheet.\n\n\n```kotlin\nval sheetState = rememberModalBottomSheetState()\nval scope = rememberCoroutineScope()\nvar showBottomSheet by remember { mutableStateOf(false) }\nScaffold(\n floatingActionButton = {\n ExtendedFloatingActionButton(\n text = { Text(\"Show bottom sheet\") },\n icon = { Icon(Icons.Filled.Add, contentDescription = \"\") },\n onClick = {\n showBottomSheet = true\n }\n )\n }\n) { contentPadding -\u003e\n // Screen content\n\n if (showBottomSheet) {\n ModalBottomSheet(\n onDismissRequest = {\n showBottomSheet = false\n },\n sheetState = sheetState\n ) {\n // Sheet content\n Button(onClick = {\n scope.launch { sheetState.hide() }.invokeOnCompletion {\n if (!sheetState.isVisible) {\n showBottomSheet = false\n }\n }\n }) {\n Text(\"Hide bottom sheet\")\n }\n }\n }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt#L370-L408\n```\n\n\u003cbr /\u003e"]]