Compose Unstyled 2.0 is out! Check the official announcement blog ->
Composable Function

rememberModalBottomSheetState

Create and remember a SheetState for ModalBottomSheet.

rememberModalBottomSheetState

Deprecated

Use rememberBottomSheetState with Hidden initial value

Source set: Common
@Composable
@ExperimentalMaterial3Api
fun rememberModalBottomSheetState(
    skipPartiallyExpanded: Boolean = false,
    confirmValueChange: (SheetValue) -> Boolean = { true },
) =
    rememberSheetState(
        initialValue = Hidden,
        enabledValues =
            if (skipPartiallyExpanded) setOf(Hidden, Expanded)
            else setOf(Hidden, PartiallyExpanded, Expanded),
        confirmValueChange = confirmValueChange,
        isBottomSheetPartiallyExpandedDeterministicEnabled = false,
    )

Create and remember a SheetState for ModalBottomSheet.

Parameters

skipPartiallyExpanded Whether the partially expanded state, if the sheet is large enough, should be skipped. If true, the sheet will always expand to the Expanded state and move to the Hidden state when hiding the sheet, either programmatically or by user interaction.
confirmValueChange Optional callback invoked to confirm or veto a pending state change.

Last updated: