🌈 Create new beautiful Compose Gradients with our new wesite ->
Compose Component

SwipeToDismiss

A composable that can be dismissed by swiping left or right.

SwipeToDismiss

Source set: Common
@Composable
public fun SwipeToDismiss(
    state: DismissState,
    modifier: Modifier = Modifier,
    directions: Set<DismissDirection> = setOf(EndToStart, StartToEnd),
    dismissThresholds: (DismissDirection) -> ThresholdConfig = {
        FixedThreshold(DISMISS_THRESHOLD)
    },
    background: @Composable RowScope.() -> Unit,
    dismissContent: @Composable RowScope.() -> Unit,
): Unit

Parameters

state The state of this component.
modifier Optional Modifier for this component.
directions The set of directions in which the component can be dismissed.
dismissThresholds The thresholds the item needs to be swiped in order to be dismissed.
background A composable that is stacked behind the content and is exposed when the content is swiped. You can/should use the state to have different backgrounds on each side.
dismissContent The content that can be dismissed.