by @alexstyl
✉️ Leave your feedback

← Back to Wear Material

SwipeToRevealChip

Component
in
Wear Material
. Since 1.3.0-alpha06

Overview

Examples

Community Notes

SwipeToReveal Material composable for Chips. This adds the option to configure up to two additional actions on the Chip: a mandatory primaryAction and an optional secondaryAction. These actions are initially hidden and revealed only when the content is swiped. These additional actions can be triggered by clicking on them after they are revealed. primaryAction can also be triggered by performing a full swipe of the content.

For actions like "Delete", consider adding undoPrimaryAction (displayed when the primaryAction is activated) and/or undoSecondaryAction (displayed when the secondaryAction is activated). Adding undo composables allow users to undo the action that they just performed.

Example of SwipeToRevealChip with primary and secondary actions

Overloads

SwipeToRevealChip

@ExperimentalWearMaterialApi
@OptIn(ExperimentalWearFoundationApi::class)
@Composable
public fun SwipeToRevealChip(
    primaryAction: SwipeToRevealAction,
    revealState: RevealState,
    modifier: Modifier = Modifier,
    secondaryAction: SwipeToRevealAction? = null,
    undoPrimaryAction: SwipeToRevealAction? = null,
    undoSecondaryAction: SwipeToRevealAction? = null,
    colors: SwipeToRevealActionColors = SwipeToRevealDefaults.actionColors(),
    shape: Shape = MaterialTheme.shapes.small,
    content: @Composable () -> Unit
)

Parameters

NameDescription
primaryActionA SwipeToRevealAction instance to describe the primary action when swiping. See SwipeToRevealDefaults.primaryAction. The action will be triggered on click or a full swipe.
revealStateRevealState of the SwipeToReveal
modifierModifier to be applied on the composable
secondaryActionA SwipeToRevealAction instance to describe the contents of secondary action. See SwipeToRevealDefaults.secondaryAction. The action will be triggered on clicking the action.
undoPrimaryActionA SwipeToRevealAction instance to describe the contents of undo action when the primary action was triggered. See SwipeToRevealDefaults.undoAction.
undoSecondaryActionSwipeToRevealAction instance to describe the contents of undo action when secondary action was triggered. See SwipeToRevealDefaults.undoAction.
colorsAn instance of SwipeToRevealActionColors to describe the colors of actions. See SwipeToRevealDefaults.actionColors.
shapeThe shape of primary and secondary action composables. Recommended shape for chips is Shapes.small.
contentThe initial content shown prior to the swipe-to-reveal gesture. @see SwipeToReveal
Previous ComponentSwipeToRevealCard
Next ComponentSwipeToRevealPrimaryAction