---
title: "ModalBottomSheetState"
description: "State of the [ModalBottomSheetLayout] composable."
type: "class"
---

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


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

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


```kotlin
class ModalBottomSheetState(
    initialValue: ModalBottomSheetValue,
    density: Density,
    confirmValueChange: (ModalBottomSheetValue) -> Boolean = { true },
    internal val animationSpec: AnimationSpec<Float> = ModalBottomSheetDefaults.AnimationSpec,
    internal val isSkipHalfExpanded: Boolean = false,
)
```


State of the `ModalBottomSheetLayout` composable.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. <b>Must not be set to `ModalBottomSheetValue.HalfExpanded` if `isSkipHalfExpanded` is set to true.</b> |
| density | The density that this state can use to convert values to and from dp. |
| confirmValueChange | Optional callback invoked to confirm or veto a pending state change. |
| animationSpec | The default animation that will be used to animate to a new state. |
| isSkipHalfExpanded | Whether 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. <b>Must not be set to true if the initialValue is `ModalBottomSheetValue.HalfExpanded`.</b> If supplied with `ModalBottomSheetValue.HalfExpanded` for the initialValue, an `IllegalArgumentException` will be thrown. |



## Properties

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


```kotlin
val currentValue: ModalBottomSheetValue
```


The current value of the `ModalBottomSheetState`.



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


```kotlin
val targetValue: ModalBottomSheetValue
```


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>


> **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.



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


```kotlin
val isVisible: Boolean
```


Whether the bottom sheet is visible.



## Functions

```kotlin
@FloatRange(from = 0.0, to = 1.0)
    fun progress(from: ModalBottomSheetValue, to: ModalBottomSheetValue): 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 show()
```


Show the bottom sheet with animation and suspend until it's shown. If the sheet is taller
than 50% of the parent's height, the bottom sheet will be half expanded. Otherwise it will be
fully expanded.


```kotlin
suspend fun hide() = animateTo(Hidden)
```


Hide the bottom sheet with animation and suspend until it if fully hidden or animation has
been cancelled.


## Companion Object

#### Methods

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


```kotlin
fun Saver(
            animationSpec: AnimationSpec<Float>,
            confirmValueChange: (ModalBottomSheetValue) -> Boolean,
            skipHalfExpanded: Boolean,
            density: Density,
        ): Saver<ModalBottomSheetState, *>
```


The default `Saver` implementation for `ModalBottomSheetState`. Saves the `currentValue`
and recreates a `ModalBottomSheetState` with the saved value as initial value.





