---
title: "BackdropScaffoldState"
description: "State of the [BackdropScaffold] composable."
type: "class"
---

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


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

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


```kotlin
class BackdropScaffoldState
@Deprecated(
    "This constructor is deprecated. Density must be provided by the component. " +
        "Please use the constructor that provides a [Density].",
    ReplaceWith(
        """
            BackdropScaffoldState(
                initialValue = initialValue,
                density = LocalDensity.current,
                animationSpec = animationSpec,
                confirmValueChange = confirmValueChange
            )
            """
    ),
)
constructor(
    initialValue: BackdropValue,
    animationSpec: AnimationSpec<Float> = BackdropScaffoldDefaults.AnimationSpec,
    val confirmValueChange: (BackdropValue) -> Boolean = { true },
    val snackbarHostState: SnackbarHostState = SnackbarHostState(),
)
```


State of the `BackdropScaffold` composable.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. |
| 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. |
| snackbarHostState | The `SnackbarHostState` used to show snackbars inside the scaffold. |



## Properties

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


```kotlin
val currentValue: BackdropValue
```


The current value of the `BottomSheetState`.



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


```kotlin
val targetValue: BackdropValue
```


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 isRevealed: Boolean
```


Whether the back layer is revealed.



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


```kotlin
val isConcealed: Boolean
```


Whether the back layer is concealed.



## Functions

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


Require the current offset.


```kotlin
suspend fun reveal() = anchoredDraggableState.animateTo(targetValue = Revealed)
```


Reveal the back layer with animation and suspend until it if fully revealed or animation has
been cancelled. This method will throw `CancellationException` if the animation is
interrupted


```kotlin
suspend fun conceal() = anchoredDraggableState.animateTo(targetValue = Concealed)
```


Conceal the back layer with animation and suspend until it if fully concealed or animation
has been cancelled. This method will throw `CancellationException` if the animation is
interrupted


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



## Companion Object

#### Methods

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


```kotlin
fun Saver(
            animationSpec: AnimationSpec<Float>,
            confirmStateChange: (BackdropValue) -> Boolean,
            snackbarHostState: SnackbarHostState,
            density: Density,
        ): Saver<BackdropScaffoldState, *>
```


The default `Saver` implementation for `BackdropScaffoldState`.





