androidx.compose.material3

BottomSheetSince 1.11Experimental

Composable function

One of the bottom sheet types. It works like ModalBottomSheet. Only the parameters that differ are described here.

Only the sheet: no dim layer, no window, no scaffold. Place it yourself in your layout.

A sheet on its own, without a dim layer
A sheet on its own, without a dim layer
Box(Modifier.size(360.dp, 300.dp)) {
    BottomSheet(state = rememberBottomSheetState(SheetValue.Expanded)) {
        Text("Filters", Modifier.padding(horizontal = 16.dp), style = MaterialTheme.typography.titleMedium)
        Spacer(Modifier.height(80.dp))
    }
}

ParametersExperimental

@Composable
fun BottomSheet(
    modifier: Modifier = Modifier,
    state: SheetState = rememberBottomSheetState(initialValue = Hidden),
    onDismissRequest: () -> Unit = {},
    maxWidth: Dp = BottomSheetDefaults.SheetMaxWidth,
    gesturesEnabled: Boolean = true,
    backHandlerEnabled: Boolean = true,
    dragHandle: @Composable (() -> Unit)? = { BottomSheetDefaults.DragHandle() },
    contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.standardWindowInsets },
    shape: Shape = BottomSheetDefaults.ExpandedShape,
    containerColor: Color = BottomSheetDefaults.ContainerColor,
    contentColor: Color = contentColorFor(containerColor),
    tonalElevation: Dp = BottomSheetDefaults.Elevation,
    shadowElevation: Dp = 0.dp,
    content: @Composable ColumnScope.() -> Unit,
)

state: SheetStateOptional

Default: rememberBottomSheetState(initialValue = Hidden)

The position of a BottomSheet. Create it with rememberBottomSheetState(...).

maxWidth: DpOptional

Default: BottomSheetDefaults.SheetMaxWidth

The widest the sheet can be.

gesturesEnabled: BooleanOptional

Default: true

Set to false to stop the user from dragging the sheet.

backHandlerEnabled: BooleanOptional

Default: true

Set to false so back does not close the sheet.

shadowElevation: DpOptional

Default: 0.dp

The size of the shadow above the sheet.

Defaults that differ from ModalBottomSheet:

Same as in ModalBottomSheet: modifier, onDismissRequest, dragHandle, contentWindowInsets, shape, containerColor, contentColor, tonalElevation, content.

Bottom sheet types

See also