BottomSheetScaffold

fun BottomSheetScaffold(sheetContent: @Composable BoxScope.() -> Unit, modifier: Modifier = Modifier, sheetPeekHeight: Dp = BottomSheetDefaults.SheetPeekHeight, scaffoldState: BottomSheetScaffoldState = rememberBottomSheetScaffoldState(), sheetSwipeEnabled: Boolean = true, sheetDragHandle: @Composable () -> Unit? = { DragHandle() }, topBar: @Composable () -> Unit? = null, snackbarHost: @Composable (SnackbarHostState) -> Unit = { androidx.compose.material3.SnackbarHost(it) }, content: @Composable (PaddingValues) -> Unit)(source)

BottomSheetScaffold is a composable that implements a scaffold with a bottom sheet. It is a wrapper around androidx.compose.material3.BottomSheetScaffold. It provides a way to display a bottom sheet that can be swiped up and down. The scaffold can have a top bar, a screen content, a bottom sheet content, and a drag handle. The scaffold can also have a snackbar host.

Parameters

sheetContent

The content of the bottom sheet.

modifier

The modifier to apply to this layout.

scaffoldState

The state of the scaffold.

sheetSwipeEnabled

Whether the sheet can be swiped.

topBar

The top bar composable.

snackbarHost

The snackbar host composable.

content

The content of the screen.

Samples

BottomSheetScaffold(
    modifier = Modifier.fillMaxSize(),
    sheetContent = {
        Box(
            modifier = Modifier
                .fillMaxWidth()
                .height(400.dp),
        ) {
            Text(
                modifier = Modifier.align(TopCenter),
                text = "Sheet Content — swipe up to expand",
            )
        }
    },
) { paddingValues ->
    LazyColumn(
        contentPadding = paddingValues,
    ) {
        items(20) { index ->
            ListItem(
                modifier = Modifier.padding(horizontal = 16.dp),
                headlineContent = { Text("Item $index") },
            )
        }
    }
}