# SwipeToReveal

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)( primaryAction: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSwipePrimaryAction: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, secondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, undoPrimaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, undoSecondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, revealState: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState, revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection, hasPartiallyRevealedState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, gestureInclusion: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion, actionContentSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` material composable component which allows to reveal hidden actions via swipe gesture. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)( primaryAction: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onSwipePrimaryAction: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, transformation: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SurfaceTransformation?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, secondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, undoPrimaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, undoSecondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, revealState: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState, revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection, hasPartiallyRevealedState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, gestureInclusion: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion, actionContentSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` Material composable. |

## Functions

### SwipeToReveal

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/SwipeToReveal.kt+function:SwipeToReveal)

```
@Composable
fun SwipeToReveal(
    primaryAction: @Composable SwipeToRevealScope.() -> Unit,
    onSwipePrimaryAction: () -> Unit,
    modifier: Modifier = Modifier,
    secondaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    undoPrimaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    undoSecondaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    revealState: RevealState = rememberRevealState(),
    revealDirection: RevealDirection = RightToLeft,
    hasPartiallyRevealedState: Boolean = true,
    gestureInclusion: GestureInclusion = if (revealDirection == Bidirectional) {
            bidirectionalGestureInclusion
        } else {
            gestureInclusion(revealState)
        },
    actionContentSpacing: Dp = SwipeToRevealDefaults.ActionContentSpacing,
    content: @Composable () -> Unit
): Unit
```

`https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` material composable component which allows to reveal hidden actions via swipe gesture.

It is recommended to use `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealDefaults#ActionContentSpacing()` as spacing between the actions and the content.

For actions `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#SecondaryActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` can be used.

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a Card composable, it reveals a taller button:

```kotlin
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Card
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.SwipeToRevealDefaults
import androidx.wear.compose.material3.Text

SwipeToReveal(
    primaryAction = {
        PrimaryActionButton(
            onClick = { /* This block is called when the primary action is executed. */ },
            icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
            text = { Text("Delete") },
            modifier = Modifier.height(SwipeToRevealDefaults.LargeActionButtonHeight),
        )
    },
    onSwipePrimaryAction = {
        /* This block is called when the full swipe gesture is performed. */
    },
    undoPrimaryAction = {
        UndoActionButton(
            onClick = { /* This block is called when the undo primary action is executed. */ },
            text = { Text("Undo Delete") },
        )
    },
) {
    Card(
        modifier =
            Modifier.fillMaxWidth().semantics {
                // Use custom actions to make the primary action accessible
                customActions =
                    listOf(
                        CustomAccessibilityAction("Delete") {
                            /* Add the primary action click handler here */
                            true
                        }
                    )
            },
        onClick = {},
    ) {
        Text(
            "This Card has one action, and the revealed button is taller",
            modifier = Modifier.fillMaxSize(),
        )
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)`, including resetting the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` when scrolling:

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.height
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Card
import androidx.wear.compose.material3.CardDefaults
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.RevealValue
import androidx.wear.compose.material3.SurfaceTransformation
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.SwipeToRevealDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TitleCard
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight
import androidx.wear.compose.material3.rememberRevealState

val transformationSpec = rememberTransformationSpec()
val tlcState = rememberTransformingLazyColumnState()
val coroutineScope = rememberCoroutineScope()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("Message #${i}")
        }
    }
}

TransformingLazyColumn(
    state = tlcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        val revealState = rememberRevealState()

        // SwipeToReveal should be reset to covered when scrolling occurs.
        LaunchedEffect(tlcState.isScrollInProgress) {
            if (
                tlcState.isScrollInProgress && revealState.currentValue != RevealValue.Covered
            ) {
                coroutineScope.launch {
                    revealState.animateTo(targetValue = RevealValue.Covered)
                }
            }
        }

        SwipeToReveal(
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                    modifier = Modifier.height(SwipeToRevealDefaults.LargeActionButtonHeight),
                )
            },
            revealState = revealState,
            onSwipePrimaryAction = { messages.remove(message) },
            transformation = SurfaceTransformation(transformationSpec),
            modifier =
                Modifier.transformedHeight(this@items, transformationSpec)
                    .animateItem()
                    .minimumVerticalContentPadding(
                        CardDefaults.minimumVerticalListContentPadding
                    ),
        ) {
            TitleCard(
                onClick = {},
                title = { Text(message) },
                subtitle = { Text("Subtitle") },
                modifier =
                    Modifier.semantics {
                        // Use custom actions to make the primary action accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                }
                            )
                    },
            ) {
                Text("Message body which extends over multiple lines to extend the card")
            }
        }
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.ScalingLazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.lazy.ScalingParams,androidx.wear.compose.foundation.lazy.ScalingLazyListAnchorType,androidx.wear.compose.foundation.lazy.AutoCenteringParams,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)`, including resetting the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` when scrolling:

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.RevealValue
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.rememberRevealState

val slcState = rememberScalingLazyListState()
val coroutineScope = rememberCoroutineScope()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("This Button $i has two actions")
        }
    }
}

ScalingLazyColumn(
    state = slcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        val revealState = rememberRevealState()

        // SwipeToReveal should be reset to covered when scrolling occurs.
        LaunchedEffect(slcState.isScrollInProgress) {
            if (
                slcState.isScrollInProgress && revealState.currentValue != RevealValue.Covered
            ) {
                coroutineScope.launch {
                    revealState.animateTo(targetValue = RevealValue.Covered)
                }
            }
        }

        SwipeToReveal(
            revealState = revealState,
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                )
            },
            onSwipePrimaryAction = { messages.remove(message) },
            secondaryAction = {
                SecondaryActionButton(
                    onClick = {
                        /* This block is called when the secondary action is executed. */
                    },
                    icon = { Icon(Icons.Outlined.MoreVert, contentDescription = "Options") },
                )
            },
        ) {
            Button(
                modifier =
                    Modifier.fillMaxWidth().semantics {
                        // Use custom actions to make the primary and secondary actions
                        // accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                },
                                CustomAccessibilityAction("Options") {
                                    /* Add the secondary click handler here */
                                    true
                                },
                            )
                    },
                onClick = {},
            ) {
                Text(message, modifier = Modifier.fillMaxSize())
            }
        }
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.ScalingLazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.lazy.ScalingParams,androidx.wear.compose.foundation.lazy.ScalingLazyListAnchorType,androidx.wear.compose.foundation.lazy.AutoCenteringParams,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)` that only executes the primary action when fully swiped (and does not settle after partially revealing the action) by setting `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` = false (so `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` does not need to be reset when scrolling):

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.Text

val slcState = rememberScalingLazyListState()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("Message #${i}")
        }
    }
}

ScalingLazyColumn(
    state = slcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        SwipeToReveal(
            hasPartiallyRevealedState = false,
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                )
            },
            onSwipePrimaryAction = { messages.remove(message) },
        ) {
            Button(
                modifier =
                    Modifier.fillMaxWidth().semantics {
                        // Use custom actions to make the primary action accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                }
                            )
                    },
                onClick = {},
            ) {
                Text(message, modifier = Modifier.fillMaxSize())
            }
        }
    }
}
```

| Parameters |
|---|---|
| `primaryAction: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The primary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, the undo button will be displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the primary action button has been hidden. |
| `onSwipePrimaryAction: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A callback which will be triggered when a full swipe is performed. It is expected that the same callback is given to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`'s onClick action. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, that will be displayed after the swipe gesture is completed. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied on the composable. |
| `secondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional secondary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#SecondaryActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, the undo button will be displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the secondary action button has been hidden. |
| `undoPrimaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional undo action for the primary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. Displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the primary action button has been hidden. |
| `undoSecondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional undo action for the secondary action of this component, displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the secondary action button has been hidden. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is ignored if the secondary action has not been specified. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. |
| `revealState: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState = rememberRevealState()` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` of the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`. |
| `revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection = RightToLeft` | The direction from which `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` can reveal the actions. It is strongly recommended to respect the default value of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection#RightToLeft()` to avoid conflicting with the system-side swipe-to-dismiss gesture. |
| `hasPartiallyRevealedState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Determines whether the intermediate states `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#RightRevealing()` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#LeftRevealing()` are used. These indicate a settled state, where the primary action is partially revealed. By default, partially revealed state is allowed for single actions - set to false to make actions complete when swiped instead. This flag has no effect if a secondary action is provided (when there are two actions, the component always allows the partially revealed states). |
| `gestureInclusion: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion = if (revealDirection == Bidirectional) { bidirectionalGestureInclusion } else { gestureInclusion(revealState) }` | Provides fine-grained control so that touch gestures can be excluded when they start in a certain region. An instance of `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion` can be passed in here which will determine via `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion#ignoreGestureStart(androidx.compose.ui.geometry.Offset,androidx.compose.ui.layout.LayoutCoordinates)` whether the gesture should proceed or not. By default, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` allows gestures everywhere for when `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` contains anchors for both directions (see `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealDefaults#bidirectionalGestureInclusion()`). If it doesn't, then it allows gestures everywhere, except a zone on the left edge, which is used for swipe-to-dismiss (see `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`). |
| `actionContentSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = SwipeToRevealDefaults.ActionContentSpacing` | The space between the main content and the actions. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The content that will be initially displayed over the other actions provided. Custom accessibility actions should always be added to the content using `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/semantics.modifier#(androidx.compose.ui.Modifier).semantics(kotlin.Boolean,kotlin.Function1)` - examples are shown in the code samples. |

### SwipeToReveal

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/SwipeToReveal.kt+function:SwipeToReveal)

```
@Composable
fun SwipeToReveal(
    primaryAction: @Composable SwipeToRevealScope.() -> Unit,
    onSwipePrimaryAction: () -> Unit,
    transformation: SurfaceTransformation?,
    modifier: Modifier = Modifier,
    secondaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    undoPrimaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    undoSecondaryAction: (@Composable SwipeToRevealScope.() -> Unit)? = null,
    revealState: RevealState = rememberRevealState(),
    revealDirection: RevealDirection = RevealDirection.RightToLeft,
    hasPartiallyRevealedState: Boolean = true,
    gestureInclusion: GestureInclusion = if (revealDirection == Bidirectional) {
            bidirectionalGestureInclusion
        } else {
            gestureInclusion(revealState)
        },
    actionContentSpacing: Dp = SwipeToRevealDefaults.ActionContentSpacing,
    content: @Composable () -> Unit
): Unit
```

`https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` Material composable. This adds the option to configure up to two additional actions on a Composable: a mandatory `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` and an optional `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`. These actions are initially hidden (unless `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` is created with an initial value other than `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()`) and revealed only when the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is swiped - the action buttons can then be clicked. A full swipe of the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` triggers the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` callback, which is expected to match the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`'s onClick callback. Custom accessibility actions should always be added to the content using `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/semantics.modifier#(androidx.compose.ui.Modifier).semantics(kotlin.Boolean,kotlin.Function1)` - examples are shown in the code samples.

Adding undo actions allows users to undo a primary or secondary action that may have been performed inadvertently. The corresponding undo action is displayed when the primary or secondary action is triggered via click or swipe and after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state. After the undo action is clicked, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` animates back to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` state and the user can then swipe to reveal if they wish to perform another action.

For destructive actions like "Delete", consider making this the primary action, and providing the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`.

When using SwipeToReveal with large content items like `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/Card.composable#Card(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.String,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material3.CardColors,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.wear.compose.material3.SurfaceTransformation,kotlin.Function1)`s, it is recommended to set the height of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#SecondaryActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealDefaults#LargeActionButtonHeight()` using `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/height.modifier#(androidx.compose.ui.Modifier).height(androidx.compose.foundation.layout.IntrinsicSize)` - in other cases, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/Button.composable#Button(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.String,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material3.ButtonColors,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.wear.compose.material3.SurfaceTransformation,kotlin.Function1)` displayed by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has height `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ButtonDefaults#Height()` by default. It is recommended to always use the default undo button height as created by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`.

If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` = true, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` should be reset to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` by the caller when scrolling occurs. This is because the revealed actions are vertically centered on the visible part of the content when the actions are revealed and, if the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` is not reset to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()`, actions for tall items would appear off-center when the list is scrolled. See the code samples for examples.

If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is set to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection#Bidirectional()`, the actions revealed on swipe are the same on both sides.

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with primary and secondary actions and custom accessibility actions:

```kotlin
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.Text

SwipeToReveal(
    primaryAction = {
        PrimaryActionButton(
            onClick = { /* This block is called when the primary action is executed. */ },
            icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
            text = { Text("Delete") },
        )
    },
    onSwipePrimaryAction = {
        /* This block is called when the full swipe gesture is performed. */
    },
    secondaryAction = {
        SecondaryActionButton(
            onClick = { /* This block is called when the secondary action is executed. */ },
            icon = { Icon(Icons.Outlined.MoreVert, contentDescription = "Options") },
        )
    },
    undoPrimaryAction = {
        UndoActionButton(
            onClick = { /* This block is called when the undo primary action is executed. */ },
            text = { Text("Undo Delete") },
        )
    },
) {
    Button(
        modifier =
            Modifier.fillMaxWidth().semantics {
                // Use custom actions to make the primary and secondary actions accessible
                customActions =
                    listOf(
                        CustomAccessibilityAction("Delete") {
                            /* Add the primary action click handler here */
                            true
                        },
                        CustomAccessibilityAction("Options") {
                            /* Add the secondary click handler here */
                            true
                        },
                    )
            },
        onClick = {},
    ) {
        Text("This Button has two actions", modifier = Modifier.fillMaxSize())
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a Card composable, it reveals a taller button:

```kotlin
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Card
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.SwipeToRevealDefaults
import androidx.wear.compose.material3.Text

SwipeToReveal(
    primaryAction = {
        PrimaryActionButton(
            onClick = { /* This block is called when the primary action is executed. */ },
            icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
            text = { Text("Delete") },
            modifier = Modifier.height(SwipeToRevealDefaults.LargeActionButtonHeight),
        )
    },
    onSwipePrimaryAction = {
        /* This block is called when the full swipe gesture is performed. */
    },
    undoPrimaryAction = {
        UndoActionButton(
            onClick = { /* This block is called when the undo primary action is executed. */ },
            text = { Text("Undo Delete") },
        )
    },
) {
    Card(
        modifier =
            Modifier.fillMaxWidth().semantics {
                // Use custom actions to make the primary action accessible
                customActions =
                    listOf(
                        CustomAccessibilityAction("Delete") {
                            /* Add the primary action click handler here */
                            true
                        }
                    )
            },
        onClick = {},
    ) {
        Text(
            "This Card has one action, and the revealed button is taller",
            modifier = Modifier.fillMaxSize(),
        )
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)`, including resetting the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` when scrolling:

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.height
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.TransformingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Card
import androidx.wear.compose.material3.CardDefaults
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.RevealValue
import androidx.wear.compose.material3.SurfaceTransformation
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.SwipeToRevealDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TitleCard
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight
import androidx.wear.compose.material3.rememberRevealState

val transformationSpec = rememberTransformationSpec()
val tlcState = rememberTransformingLazyColumnState()
val coroutineScope = rememberCoroutineScope()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("Message #${i}")
        }
    }
}

TransformingLazyColumn(
    state = tlcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        val revealState = rememberRevealState()

        // SwipeToReveal should be reset to covered when scrolling occurs.
        LaunchedEffect(tlcState.isScrollInProgress) {
            if (
                tlcState.isScrollInProgress && revealState.currentValue != RevealValue.Covered
            ) {
                coroutineScope.launch {
                    revealState.animateTo(targetValue = RevealValue.Covered)
                }
            }
        }

        SwipeToReveal(
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                    modifier = Modifier.height(SwipeToRevealDefaults.LargeActionButtonHeight),
                )
            },
            revealState = revealState,
            onSwipePrimaryAction = { messages.remove(message) },
            transformation = SurfaceTransformation(transformationSpec),
            modifier =
                Modifier.transformedHeight(this@items, transformationSpec)
                    .animateItem()
                    .minimumVerticalContentPadding(
                        CardDefaults.minimumVerticalListContentPadding
                    ),
        ) {
            TitleCard(
                onClick = {},
                title = { Text(message) },
                subtitle = { Text("Subtitle") },
                modifier =
                    Modifier.semantics {
                        // Use custom actions to make the primary action accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                }
                            )
                    },
            ) {
                Text("Message body which extends over multiple lines to extend the card")
            }
        }
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.ScalingLazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.lazy.ScalingParams,androidx.wear.compose.foundation.lazy.ScalingLazyListAnchorType,androidx.wear.compose.foundation.lazy.AutoCenteringParams,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)`, including resetting the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#Covered()` when scrolling:

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.RevealValue
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.rememberRevealState

val slcState = rememberScalingLazyListState()
val coroutineScope = rememberCoroutineScope()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("This Button $i has two actions")
        }
    }
}

ScalingLazyColumn(
    state = slcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        val revealState = rememberRevealState()

        // SwipeToReveal should be reset to covered when scrolling occurs.
        LaunchedEffect(slcState.isScrollInProgress) {
            if (
                slcState.isScrollInProgress && revealState.currentValue != RevealValue.Covered
            ) {
                coroutineScope.launch {
                    revealState.animateTo(targetValue = RevealValue.Covered)
                }
            }
        }

        SwipeToReveal(
            revealState = revealState,
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                )
            },
            onSwipePrimaryAction = { messages.remove(message) },
            secondaryAction = {
                SecondaryActionButton(
                    onClick = {
                        /* This block is called when the secondary action is executed. */
                    },
                    icon = { Icon(Icons.Outlined.MoreVert, contentDescription = "Options") },
                )
            },
        ) {
            Button(
                modifier =
                    Modifier.fillMaxWidth().semantics {
                        // Use custom actions to make the primary and secondary actions
                        // accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                },
                                CustomAccessibilityAction("Options") {
                                    /* Add the secondary click handler here */
                                    true
                                },
                            )
                    },
                onClick = {},
            ) {
                Text(message, modifier = Modifier.fillMaxSize())
            }
        }
    }
}
```

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` with a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyColumn.composable#ScalingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.ScalingLazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.lazy.ScalingParams,androidx.wear.compose.foundation.lazy.ScalingLazyListAnchorType,androidx.wear.compose.foundation.lazy.AutoCenteringParams,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,kotlin.Function1)` that only executes the primary action when fully swiped (and does not settle after partially revealing the action) by setting `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` = false (so `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` does not need to be reset when scrolling):

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.CustomAccessibilityAction
import androidx.compose.ui.semantics.customActions
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.SwipeToReveal
import androidx.wear.compose.material3.Text

val slcState = rememberScalingLazyListState()
val messages = remember {
    mutableStateListOf<String>().apply {
        for (i in 1..100) {
            add("Message #${i}")
        }
    }
}

ScalingLazyColumn(
    state = slcState,
    contentPadding = PaddingValues(horizontal = 16.dp, vertical = 20.dp),
    modifier = Modifier.background(Color.Black),
) {
    items(items = messages, key = { it }) { message ->
        SwipeToReveal(
            hasPartiallyRevealedState = false,
            primaryAction = {
                PrimaryActionButton(
                    onClick = { messages.remove(message) },
                    icon = { Icon(Icons.Outlined.Delete, contentDescription = "Delete") },
                    text = { Text("Delete") },
                )
            },
            onSwipePrimaryAction = { messages.remove(message) },
        ) {
            Button(
                modifier =
                    Modifier.fillMaxWidth().semantics {
                        // Use custom actions to make the primary action accessible
                        customActions =
                            listOf(
                                CustomAccessibilityAction("Delete") {
                                    messages.remove(message)
                                    true
                                }
                            )
                    },
                onClick = {},
            ) {
                Text(message, modifier = Modifier.fillMaxSize())
            }
        }
    }
}
```

| Parameters |
|---|---|
| `primaryAction: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The primary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, the undo button will be displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the primary action button has been hidden. |
| `onSwipePrimaryAction: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A callback which will be triggered when a full swipe is performed. It is expected that the same callback is given to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#PrimaryActionButton(kotlin.Function0,kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`'s onClick action. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, that will be displayed after the swipe gesture is completed. |
| `transformation: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SurfaceTransformation?` | The transformation for the SwipeToReveal when it's inside a dynamically changing container such as `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)`. When specified, container transformations (e.g. scaling and alpha modulation) are applied to the entire component, ensuring revealed action buttons scale uniformly with the content. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied on the composable. |
| `secondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional secondary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#SecondaryActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. If `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is provided, the undo button will be displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the secondary action button has been hidden. |
| `undoPrimaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional undo action for the primary action of this component. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. Displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the primary action button has been hidden. |
| `undoSecondaryAction: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional undo action for the secondary action of this component, displayed after `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` has animated to the revealed state and the secondary action button has been hidden. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` is ignored if the secondary action has not been specified. `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealScope#UndoActionButton(kotlin.Function0,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` should be used to create a button for this slot. |
| `revealState: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState = rememberRevealState()` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealState` of the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`. |
| `revealDirection: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection = RevealDirection.RightToLeft` | The direction from which `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToReveal.composable#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` can reveal the actions. It is strongly recommended to respect the default value of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealDirection#RightToLeft()` to avoid conflicting with the system-side swipe-to-dismiss gesture. |
| `hasPartiallyRevealedState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Determines whether the intermediate states `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#RightRevealing()` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/RevealValue#LeftRevealing()` are used. These indicate a settled state, where the primary action is partially revealed. By default, partially revealed state is allowed for single actions - set to false to make actions complete when swiped instead. This flag has no effect if a secondary action is provided (when there are two actions, the component always allows the partially revealed states). |
| `gestureInclusion: https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion = if (revealDirection == Bidirectional) { bidirectionalGestureInclusion } else { gestureInclusion(revealState) }` | Provides fine-grained control so that touch gestures can be excluded when they start in a certain region. An instance of `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion` can be passed in here which will determine via `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/GestureInclusion#ignoreGestureStart(androidx.compose.ui.geometry.Offset,androidx.compose.ui.layout.LayoutCoordinates)` whether the gesture should proceed or not. By default, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` allows gestures everywhere for when `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)` contains anchors for both directions (see `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/SwipeToRevealDefaults#bidirectionalGestureInclusion()`). If it doesn't, then it allows gestures everywhere, except a zone on the left edge, which is used for swipe-to-dismiss (see `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#SwipeToReveal(kotlin.Function1,kotlin.Function0,androidx.wear.compose.material3.SurfaceTransformation,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.wear.compose.material3.RevealState,androidx.wear.compose.material3.RevealDirection,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,androidx.compose.ui.unit.Dp,kotlin.Function0)`). |
| `actionContentSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = SwipeToRevealDefaults.ActionContentSpacing` | The space between the main content and the actions. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The content that will be initially displayed over the other actions provided. Custom accessibility actions should always be added to the content using `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/semantics.modifier#(androidx.compose.ui.Modifier).semantics(kotlin.Boolean,kotlin.Function1)` - examples are shown in the code samples. |