04.22 · Micro-Interactions
Swipe to Dismiss
A card dragged sideways flies off and the list closes up. Best for inboxes.
Drag it
Drag a message sideways and let go, or press Show me.
Press Delete to remove this message.
Inside, the dashed marks are the delete distance: let go past one, or flick fast, and the card flies off; short of it, it springs back. Drag a message, or press Show me.
Vanishes: the message is gone the moment you let go and the list jumps up; Flies off: it slides away and the list closes up smoothly. Drag a message, or press Show me.
Try it
Change a setting, then try it again or press Show me.
Distance to delete
How far to drag before letting go deletes it.
A red Delete strip shows behind the card as you drag.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add swipe to dismiss to [the list items people should be able to remove]. While an item is dragged sideways, it follows the finger exactly and fades a little; when the settings include it, a red Delete label shows behind it. On release, remove it if it went far enough or was flicked quickly: it slides off the edge and its row closes up so the list moves up smoothly. Otherwise it springs back into place. Use pointer events so mouse, touch and pen all work, and let up-and-down scrolling still pass through. Offer an undo, and a button for people who cannot drag. If the visitor has reduced motion turned on, remove the row at once without sliding. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.