rememberModalBottomSheetState

Composable Function

Common
@Composable
fun rememberModalBottomSheetState(
    initialValue: ModalBottomSheetValue,
    animationSpec: AnimationSpec<Float> = ModalBottomSheetDefaults.AnimationSpec,
    confirmValueChange: (ModalBottomSheetValue) -> Boolean = { true },
    skipHalfExpanded: Boolean = false,
): ModalBottomSheetState

Create a ModalBottomSheetState and remember it.

Parameters

initialValueThe initial value of the state.
animationSpecThe default animation that will be used to animate to a new state.
confirmValueChangeOptional callback invoked to confirm or veto a pending state change.
skipHalfExpandedWhether the half expanded state, if the sheet is tall 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. Must not be set to true if the initialValue is ModalBottomSheetValue.HalfExpanded. If supplied with ModalBottomSheetValue.HalfExpanded for the initialValue, an IllegalArgumentException will be thrown.