All components

MotionSwipe

A row with swipe-to-reveal actions and optional swipe-to-dismiss.

WebReact NativeGestures

Try it

Preparing the example…

Shortest usage

Row.jsx
<MotionSwipe
  endActions={<button onClick={() => archive(id)}>Archive</button>}
  dismiss="end"
  onDismiss={() => remove(id)}
>
  <MessagePreview />
</MotionSwipe>;

What it handles for you

  • The row follows horizontal drags, resists past its actions and settles with your release speed.
  • With dismiss, a long swipe or a throw slides the row out, collapses its height and then calls onDismiss(side).
  • Vertical scrolling keeps working, and only one row stays open.
  • A tap on an open row closes it, and keyboard focus on an action reveals it.

Use it for

  • Archive or delete in an inbox.
  • Pin a conversation.
  • Remove an item from a list.

Props

PropTypeDefaultDescription
childrenReactNodeThe row content.
startActionsReactNodeRevealed at the inline start when the row is dragged toward the end.
endActionsReactNodeRevealed at the inline end when the row is dragged toward the start.
dismiss'start' | 'end' | 'both'Sides where a long swipe or a throw removes the row.
onDismiss(side) => voidRuns after the row slid out and collapsed; remove the item from your data here.
onOpenChange(side | null) => voidRuns with the open side, or null when the row closes.
disabledbooleanfalseTurns swiping off.
contentClassNamestringClass for the row content; contentStyle sets its inline style.
transitionTransitionspringA timing curve { duration, easing } or a spring { tempo: 'spring', spring }. Springs keep their momentum when interrupted.

Other props go to the rendered element, so className, style and event handlers work as usual.

Web and React Native

startActions appear when dragging toward the inline end, endActions when dragging toward the start. Give the row content a background with contentClassName.

React Native uses the same props and gestures.

Used in these examples

Search

Type to search the documentation.