Google is committed to advancing racial equity for Black communities. See how.

ModalBottomSheetState

class ModalBottomSheetState : SwipeableState<ModalBottomSheetValue>
kotlin.Any
   ↳ androidx.compose.material.SwipeableState<androidx.compose.material.ModalBottomSheetValue>
   ↳ androidx.compose.material.ModalBottomSheetState

State of the ModalBottomSheetLayout composable.

Summary

Public constructors
<init>(initialValue: ModalBottomSheetValue, clock: AnimationClockObservable, animationSpec: AnimationSpec<Float> = SwipeableConstants.DefaultAnimationSpec, confirmStateChange: (ModalBottomSheetValue) -> Boolean = { true })

State of the ModalBottomSheetLayout composable.

Public methods
Unit
hide(onHidden: () -> Unit = null)

Hide the bottom sheet, with an animation.

Unit
show(onShown: () -> Unit = null)

Show the bottom sheet, with an animation.

Companion functions
Saver<ModalBottomSheetState, *>
Saver(clock: AnimationClockObservable, animationSpec: AnimationSpec<Float>, confirmStateChange: (ModalBottomSheetValue) -> Boolean)

The default Saver implementation for ModalBottomSheetState.

Inherited functions
Properties
Boolean

Whether the bottom sheet is visible.

Inherited properties

Public constructors

<init>

ModalBottomSheetState(
    initialValue: ModalBottomSheetValue,
    clock: AnimationClockObservable,
    animationSpec: AnimationSpec<Float> = SwipeableConstants.DefaultAnimationSpec,
    confirmStateChange: (ModalBottomSheetValue) -> Boolean = { true })

State of the ModalBottomSheetLayout composable.

Parameters
initialValue: ModalBottomSheetValue The initial value of the state.
clock: AnimationClockObservable The animation clock that will be used to drive the animations.
animationSpec: AnimationSpec<Float> = SwipeableConstants.DefaultAnimationSpec The default animation that will be used to animate to a new state.
confirmStateChange: (ModalBottomSheetValue) -> Boolean = { true } Optional callback invoked to confirm or veto a pending state change.

Public methods

hide

fun hide(onHidden: () -> Unit = null): Unit

Hide the bottom sheet, with an animation.

Parameters
onHidden: () -> Unit = null Optional callback invoked when the bottom sheet has been hidden.

show

fun show(onShown: () -> Unit = null): Unit

Show the bottom sheet, with an animation.

Parameters
onShown: () -> Unit = null Optional callback invoked when the bottom sheet has been shown.

Properties

isVisible

val isVisible: Boolean

Whether the bottom sheet is visible.

Companion functions

Saver

fun Saver(
    clock: AnimationClockObservable,
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (ModalBottomSheetValue) -> Boolean
): Saver<ModalBottomSheetState, *>

The default Saver implementation for ModalBottomSheetState.