@ComposablefunPartialBottomSheet(){varshowBottomSheetbyremember{mutableStateOf(false)}valsheetState=rememberModalBottomSheetState(skipPartiallyExpanded=false,)Column(modifier=Modifier.fillMaxWidth(),horizontalAlignment=Alignment.CenterHorizontally,){Button(onClick={showBottomSheet=true}){Text("Display partial bottom sheet")}if(showBottomSheet){ModalBottomSheet(modifier=Modifier.fillMaxHeight(),sheetState=sheetState,onDismissRequest={showBottomSheet=false}){Text("Swipe up to open sheet. Swipe down to dismiss.",modifier=Modifier.padding(16.dp))}}}}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-30。"],[],[],null,["You can partially show a [bottom sheet](/develop/ui/compose/components/bottom-sheets) and then let the user either make it\nfull screen or dismiss it.\n\nTo do so, pass your [`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,kotlin.Function0,androidx.compose.material3.ModalBottomSheetProperties,kotlin.Function1)) an instance of [`SheetState`](/reference/kotlin/androidx/compose/material3/SheetState)\nwith `skipPartiallyExpanded` set to `false`.\n| **Note:** `ModalBottomSheet` is experimental. File any issues on the [issue\n| tracker](https://issuetracker.google.com/issues/new?component=856989&template=1425922).\n\nExample\n\nThis example demonstrates how you can use the `sheetState` property of\n`ModalBottomSheet` to display the sheet only partially at first:\n\n\n```kotlin\n@Composable\nfun PartialBottomSheet() {\n var showBottomSheet by remember { mutableStateOf(false) }\n val sheetState = rememberModalBottomSheetState(\n skipPartiallyExpanded = false,\n )\n\n Column(\n modifier = Modifier.fillMaxWidth(),\n horizontalAlignment = Alignment.CenterHorizontally,\n ) {\n Button(\n onClick = { showBottomSheet = true }\n ) {\n Text(\"Display partial bottom sheet\")\n }\n\n if (showBottomSheet) {\n ModalBottomSheet(\n modifier = Modifier.fillMaxHeight(),\n sheetState = sheetState,\n onDismissRequest = { showBottomSheet = false }\n ) {\n Text(\n \"Swipe up to open sheet. Swipe down to dismiss.\",\n modifier = Modifier.padding(16.dp)\n )\n }\n }\n }\n}https://github.com/android/snippets/blob/f95ab59fad80aeaf5d6a90bab8a01a126f20f44e/compose/snippets/src/main/java/com/example/compose/snippets/components/BottomSheet.kt#L41-L71\n```\n\n\u003cbr /\u003e\n\nKey points about the code\n\nIn this example, note the following:\n\n- `showBottomSheet` controls whether the app displays the bottom sheet.\n- `sheetState` is an instance of [`SheetState`](/reference/kotlin/androidx/compose/material3/SheetState) where `skipPartiallyExpanded` is false.\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,kotlin.Function0,androidx.compose.material3.ModalBottomSheetProperties,kotlin.Function1)) takes a modifier that ensures it fills the screen when fully expanded.\n- `ModalBottomSheet` takes `sheetState` as the value for its `sheetState` parameter.\n - As a result, the sheet only partially displays when first opened. The user can then drag or swipe it to make it full screen or dismiss it.\n- The `onDismissRequest` lambda controls what happens when the user tries to dismiss the bottom sheet. In this case, it only removes the sheet.\n\nResults\n\nWhen the user first presses the button, the sheet displays partially:\n**Figure 1.** Partially displayed bottom sheet.\n\nIf the user swipes up on the sheet, it fills the screen:\n**Figure 2.** Full-screen bottom sheet. **Note:** If you set `skipPartiallyExpanded` to true, the sheet opens immediately to full screen.\n\nAdditional resources\n\n- [Bottom sheets](/develop/ui/compose/components/bottom-sheets)"]]