---
title: "BottomDrawerState"
description: "State of the [BottomDrawer] composable."
type: "class"
---

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


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

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


```kotlin
class BottomDrawerState(
    initialValue: BottomDrawerValue,
    density: Density,
    confirmStateChange: (BottomDrawerValue) -> Boolean = { true },
    animationSpec: AnimationSpec<Float> = DrawerDefaults.AnimationSpec,
)
```


State of the `BottomDrawer` composable.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. |
| density | The density that this state can use to convert values to and from dp. |
| confirmStateChange | Optional callback invoked to confirm or veto a pending state change. |
| animationSpec | The animation spec to be used for open/close animations, as well as settling when a user lets go. |



## Properties

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


```kotlin
val targetValue: BottomDrawerValue
```


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 offset: Float
```


The current offset in pixels, or `Float.NaN` if it has not been initialized yet.



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


```kotlin
val currentValue: BottomDrawerValue
```


The current value of the `BottomDrawerState`.



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


```kotlin
val isOpen: Boolean
```


Whether the drawer is open, either in opened or expanded state.



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


```kotlin
val isClosed: Boolean
```


Whether the drawer is closed.



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


```kotlin
val isExpanded: Boolean
```


Whether the drawer is expanded.



<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: BottomDrawerValue, to: BottomDrawerValue): 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 open()
```


Open the drawer with animation and suspend until it if fully opened or animation has been
cancelled. If the content height is less than `BottomDrawerOpenFraction`, the drawer state
will move to `BottomDrawerValue.Expanded` instead.


```kotlin
suspend fun close() = anchoredDraggableState.animateTo(Closed)
```


Close the drawer with animation and suspend until it if fully closed or animation has been
cancelled.


```kotlin
suspend fun expand() = anchoredDraggableState.animateTo(Expanded)
```


Expand the drawer with animation and suspend until it if fully expanded or animation has been
cancelled.


## Companion Object

#### Methods

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


```kotlin
fun Saver(
            density: Density,
            confirmStateChange: (BottomDrawerValue) -> Boolean,
            animationSpec: AnimationSpec<Float>,
        ) =
            Saver<BottomDrawerState, BottomDrawerValue>(
                save = { it.anchoredDraggableState.currentValue },
                restore = { BottomDrawerState(it, density, confirmStateChange, animationSpec) },
            )
```


The default `Saver` implementation for `BottomDrawerState`.





