# SwipeToRevealDefaults

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


```
@ExperimentalWearMaterialApi
object SwipeToRevealDefaults
```

<br />

*** ** * ** ***

Defaults for Material `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToReveal(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.wear.compose.material.RevealState,kotlin.Function0,kotlin.Function0,kotlin.Function0)`.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealActionColors` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#actionColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)( primaryActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, primaryActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, secondaryActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, secondaryActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, undoActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, undoActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color )` The recommended colors used to display the contents of the primary, secondary and undo actions in `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToReveal(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.wear.compose.material.RevealState,kotlin.Function0,kotlin.Function0,kotlin.Function0)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#createRevealAnchors(kotlin.Float,kotlin.Float,kotlin.Float,androidx.wear.compose.material.RevealDirection)( coveredAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, revealingAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, revealedAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealDirection )` Creates the required anchors to which the top content can be swiped, to reveal the actions. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/RoundedCornerShape` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#CardActionShape()` Recommended shape for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToReveal(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.wear.compose.material.RevealState,kotlin.Function0,kotlin.Function0,kotlin.Function0)` actions when used with `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#Delete()` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` for delete icon, often used for the primary action. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#MoreOptions()` `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` for more options icon, often used for the secondary action. |
| `(totalDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#PositionalThreshold()` Default position threshold that needs to be swiped in order to transition to the next state. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#RevealingRatio()` Default ratio of the content displayed when in `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()` state, i.e. all the actions are revealed and the top content is not being swiped. |

## Public functions

### actionColors

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

```
@Composable
fun actionColors(
    primaryActionBackgroundColor: Color = MaterialTheme.colors.error,
    primaryActionContentColor: Color = MaterialTheme.colors.onError,
    secondaryActionBackgroundColor: Color = MaterialTheme.colors.surface,
    secondaryActionContentColor: Color = MaterialTheme.colors.onSurface,
    undoActionBackgroundColor: Color = MaterialTheme.colors.surface,
    undoActionContentColor: Color = MaterialTheme.colors.onSurface
): SwipeToRevealActionColors
```

The recommended colors used to display the contents of the primary, secondary and undo actions in `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToReveal(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.wear.compose.material.RevealState,kotlin.Function0,kotlin.Function0,kotlin.Function0)`.

| Parameters |
|---|---|
| `primaryActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.error` | The background color (color of the shape) of the primary action |
| `primaryActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.onError` | The content color (text and icon) of the primary action |
| `secondaryActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.surface` | The background color (color of the shape) of the secondary action |
| `secondaryActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.onSurface` | The content color (text and icon) of the secondary action |
| `undoActionBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.surface` | The background color (color of the shape) of the undo action |
| `undoActionContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.onSurface` | The content color (text) of the undo action |

### createRevealAnchors

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

```
fun createRevealAnchors(
    coveredAnchor: Float = 0.0f,
    revealingAnchor: Float = RevealingRatio,
    revealedAnchor: Float = 1.0f,
    revealDirection: RevealDirection = RevealDirection.RightToLeft
): Map<RevealValue, Float>
```

Creates the required anchors to which the top content can be swiped, to reveal the actions. Each value should be in the range 0..1, where 0 represents right most end and 1 represents the full width of the top content starting from right and ending on left.

| Parameters |
|---|---|
| `coveredAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Anchor for the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#Covered()` value |
| `revealingAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = RevealingRatio` | Anchor for the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#LeftRevealing()` or `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()` value |
| `revealedAnchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.0f` | Anchor for the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#LeftRevealed()` or `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealed()` value |
| `revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealDirection = RevealDirection.RightToLeft` | The direction in which the content can be swiped. It's strongly advised to keep the default `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealDirection#RightToLeft()` in order to preserve compatibility with the system wide swipe to dismiss gesture. |

## Public properties

### CardActionShape

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

```
val CardActionShape: RoundedCornerShape
```

Recommended shape for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToReveal(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.wear.compose.material.RevealState,kotlin.Function0,kotlin.Function0,kotlin.Function0)` actions when used with `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`.

### Delete

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

```
val Delete: ImageVector
```

`https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` for delete icon, often used for the primary action.

### MoreOptions

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

```
val MoreOptions: ImageVector
```

`https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` for more options icon, often used for the secondary action.

### PositionalThreshold

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

```
val PositionalThreshold: (totalDistance: Float) -> Float
```

Default position threshold that needs to be swiped in order to transition to the next state. Used in conjunction with `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToRevealDefaults#RevealingRatio()`; for example, a threshold of 0.5 with a revealing ratio of 0.7 means that the user needs to swipe at least 35% (0.5 \* 0.7) of the component width to go from `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#Covered()` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()` and at least 85% (0.7 + 0.5 \* (1 - 0.7)) of the component width to go from `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealed()`.

### RevealingRatio

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

```
val RevealingRatio: Float
```

Default ratio of the content displayed when in `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()` state, i.e. all the actions are revealed and the top content is not being swiped. For example, a value of 0.7 means that 70% of the width is used to place the actions.