# RevealState

Artifact: [androidx.wear.compose:compose-foundation](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/foundation/SwipeToReveal.kt+class:androidx.wear.compose.foundation.RevealState) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)


```
@ExperimentalWearFoundationApi
class RevealState
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

A class to keep track of the state of the composable. It can be used to customise the behavior and state of the composable.

## Summary

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[animateTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#animateTo(androidx.wear.compose.foundation.RevealValue))(targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue)` **This function is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[snapTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#snapTo(androidx.wear.compose.foundation.RevealValue))(targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue)` **This function is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#currentValue()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#isAnimationRunning()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealActionType` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#lastActionType()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#offset()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#revealThreshold()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#swipeAnchors()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#targetValue()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MutableFloatState` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#width()` **This property is deprecated.** The SwipeToReveal component from the latest material library should be used instead. |

## Public functions

### animateTo

```
suspend fun [animateTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#animateTo(androidx.wear.compose.foundation.RevealValue))(targetValue: RevealValue): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

Animates to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#animateTo(androidx.wear.compose.foundation.RevealValue)` with the animation spec provided.

| Parameters |
|---|---|
| `targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` | The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` where the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#currentValue()` will animate to. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the target `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` is not valid for current `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState` instance. |

### snapTo

```
suspend fun [snapTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#snapTo(androidx.wear.compose.foundation.RevealValue))(targetValue: RevealValue): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

Snaps to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#snapTo(androidx.wear.compose.foundation.RevealValue)` without any animation.

| Parameters |
|---|---|
| `targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` | The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` where the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#currentValue()` will be changed to. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

## Public properties

### currentValue

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val currentValue: RevealValue
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

The current `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` based on the status of the component.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

### isAnimationRunning

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val isAnimationRunning: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

Returns whether the animation is running or not.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

### lastActionType

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
var lastActionType: RevealActionType
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

### offset

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val offset: Float
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

The current amount by which the revealable content has been revealed by.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

### revealThreshold

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val revealThreshold: Float
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

The threshold, in pixels, where the revealed actions are fully visible but the existing content would be left in place if the reveal action was stopped. This threshold is used to create the anchor for `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue#RightRevealing()`. If there is no such anchor defined for `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue#RightRevealing()`, it returns 0.0f.

### swipeAnchors

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val swipeAnchors: Map<RevealValue, Float>
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

Defines the anchors for revealable content. These anchors are used to determine the width at which the revealable content can be revealed to and stopped without requiring any input from the user.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

### targetValue

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.2.0)

```
val targetValue: RevealValue
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` based on the status of the component. This will be equal to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealState#currentValue()` if there is no animation running or swiping has stopped. Otherwise, this returns the next `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/RevealValue` based on the animation/swipe direction.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/package-summary#(androidx.compose.ui.Modifier).swipeableV2(androidx.wear.compose.foundation.SwipeableV2State,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource)` |   |

### width

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val width: MutableFloatState
```

> [!CAUTION]
> **This property is deprecated.**   
> The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library, use this instead:
>
> ```kotlin
> RevealState
> ```

The total width of the component in pixels. Initialise to zero, updated when the width changes.