← Back to Wear Material
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
@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 )
|A SwipeToRevealAction instance to describe the primary action when swiping. See SwipeToRevealDefaults.primaryAction. The action will be triggered on click or a full swipe.|
|RevealState of the SwipeToReveal|
|Modifier to be applied on the composable|
|A SwipeToRevealAction instance to describe the contents of secondary action. See SwipeToRevealDefaults.secondaryAction. The action will be triggered on clicking the action.|
|A SwipeToRevealAction instance to describe the contents of undo action when the primary action was triggered. See SwipeToRevealDefaults.undoAction.|
|SwipeToRevealAction instance to describe the contents of undo action when secondary action was triggered. See SwipeToRevealDefaults.undoAction.|
|An instance of SwipeToRevealActionColors to describe the colors of actions. See SwipeToRevealDefaults.actionColors.|
|The shape of primary and secondary action composables. Recommended shape for chips is Shapes.small.|
|The initial content shown prior to the swipe-to-reveal gesture. @see SwipeToReveal|