Start native apps faster with the Composables CLI ->
Compose Component

SwipeToReveal

A composable that can be used to add extra actions to a composable (up to two) which will be revealed when the original composable is swiped to the left.

SwipeToReveal

Source set: Android
@Deprecated(
    message =
        "The SwipeToReveal component from the latest material library should be used instead. This will be removed in a future release of this library.",
    replaceWith = ReplaceWith("SwipeToReveal", "androidx.wear.compose.material3.SwipeToReveal"),
)
@Composable
public fun SwipeToReveal(
    primaryAction: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    onFullSwipe: () -> Unit = {},
    state: RevealState = rememberRevealState(),
    secondaryAction: (@Composable () -> Unit)? = null,
    undoAction: (@Composable () -> Unit)? = null,
    gestureInclusion: GestureInclusion = SwipeToRevealDefaults.gestureInclusion(state = state),
    content: @Composable () -> Unit,
)

Parameters

primaryAction The primary action that will be triggered in the event of a completed swipe. We also strongly recommend to trigger the action when it is clicked.
modifier Optional Modifier for this component.
onFullSwipe An optional lambda which will be triggered when a full swipe from either of the anchors is performed.
state The RevealState of this component. It can be used to customise the anchors and threshold config of the swipeable modifier which is applied.
secondaryAction An optional action that can be added to the component. We strongly recommend triggering the action when it is clicked.
undoAction The optional undo action that will be applied to the component once the the RevealState.currentValue becomes RevealValue.RightRevealed.
gestureInclusion Provides fine-grained control so that touch gestures can be excluded when they start in a certain region. An instance of GestureInclusion can be passed in here which will determine via GestureInclusion.ignoreGestureStart whether the gesture should proceed or not. By default, gestureInclusion allows gestures everywhere except a zone on the left edge, which is used for swipe-to-dismiss (see SwipeToRevealDefaults.gestureInclusion).
content The content that will be initially displayed over the other actions provided. Custom accessibility actions should always be added to the content using androidx.compose.ui.semantics.semantics - examples are shown in the code samples.