---
title: "BottomSheetState"
description: "State of the persistent bottom sheet in [BottomSheetScaffold]."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class BottomSheetState(
    initialValue: BottomSheetValue,
    density: Density,
    animationSpec: AnimationSpec<Float> = BottomSheetScaffoldDefaults.AnimationSpec,
    confirmValueChange: (BottomSheetValue) -> Boolean = { true },
)
```


State of the persistent bottom sheet in `BottomSheetScaffold`.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. |
| density | The density that this state can use to convert values to and from dp. |
| animationSpec | The default animation that will be used to animate to a new state. |
| confirmValueChange | Optional callback invoked to confirm or veto a pending state change. |



## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val currentValue: BottomSheetValue
```


The current value of the `BottomSheetState`.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val targetValue: BottomSheetValue
```


The target value the state will settle at once the current interaction ends, or the
`currentValue` if there is no interaction in progress.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val isExpanded: Boolean
```


Whether the bottom sheet is expanded.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val isCollapsed: Boolean
```


Whether the bottom sheet is collapsed.



<div class='sourceset sourceset-common'>Common</div>


> **Deprecated** Please use the progress function to query progress explicitly between targets.

```kotlin
@get:FloatRange(from = 0.0, to = 1.0)
@ExperimentalMaterialApi
val progress: Float
```


The fraction of the progress, within `0f..1f` bounds, or 1f if the `AnchoredDraggableState`
is in a settled state.



## Functions

```kotlin
@FloatRange(from = 0.0, to = 1.0)
    fun progress(from: BottomSheetValue, to: BottomSheetValue): Float
```


The fraction of the offset between `from` and `to`, as a fraction between `0f..1f`, or 1f if
`from` is equal to `to`.

#### Parameters

| | |
| --- | --- |
| from | The starting value used to calculate the distance |
| to | The end value used to calculate the distance |



```kotlin
suspend fun expand()
```


Expand the bottom sheet with an animation and suspend until the animation finishes or is
cancelled. Note: If the peek height is equal to the sheet height, this method will animate to
the `Collapsed` state.

This method will throw `CancellationException` if the animation is interrupted.


```kotlin
suspend fun collapse() = anchoredDraggableState.animateTo(Collapsed)
```


Collapse the bottom sheet with animation and suspend until it if fully collapsed or animation
has been cancelled. This method will throw `CancellationException` if the animation is
interrupted.


```kotlin
fun requireOffset() = anchoredDraggableState.requireOffset()
```


Require the current offset.


## Companion Object

#### Methods

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Saver(
            animationSpec: AnimationSpec<Float>,
            confirmStateChange: (BottomSheetValue) -> Boolean,
            density: Density,
        ): Saver<BottomSheetState, *>
```


The default `Saver` implementation for `BottomSheetState`.





