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

BottomSheetState

@Stable class BottomSheetState : SwipeableState<BottomSheetValue>
kotlin.Any
   ↳ androidx.compose.material.SwipeableState<androidx.compose.material.BottomSheetValue>
   ↳ androidx.compose.material.BottomSheetState

State of the persistent bottom sheet in BottomSheetScaffold.

Summary

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

State of the persistent bottom sheet in BottomSheetScaffold.

Public methods
Unit
collapse(onCollapsed: () -> Unit = null)

Collapse the bottom sheet, with an animation.

Unit
expand(onExpanded: () -> Unit = null)

Expand the bottom sheet, with an animation.

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

The default Saver implementation for BottomSheetState.

Inherited functions
Properties
Boolean

Whether the bottom sheet is collapsed.

Boolean

Whether the bottom sheet is expanded.

Inherited properties

Public constructors

<init>

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

State of the persistent bottom sheet in BottomSheetScaffold.

Parameters
initialValue: BottomSheetValue 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: (BottomSheetValue) -> Boolean = { true } Optional callback invoked to confirm or veto a pending state change.

Public methods

collapse

fun collapse(onCollapsed: () -> Unit = null): Unit

Collapse the bottom sheet, with an animation.

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

expand

fun expand(onExpanded: () -> Unit = null): Unit

Expand the bottom sheet, with an animation.

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

Properties

isCollapsed

val isCollapsed: Boolean

Whether the bottom sheet is collapsed.

isExpanded

val isExpanded: Boolean

Whether the bottom sheet is expanded.

Companion functions

Saver

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

The default Saver implementation for BottomSheetState.