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