StealThis .dev

Swipe Action

iOS-style swipe-to-reveal action buttons on list items. Swipe left to expose Archive and Delete actions. No libraries.

Open in Lab
vanilla-js css
Targets: JS HTML React Native

Expo Snack

Code

Swipe Action

A list where each item can be swiped left to reveal action buttons, just like iOS Mail. Uses touch events for mobile and pointer events for desktop support.

How it works

  1. touchstart / pointermove tracks horizontal drag on each list item
  2. The .item-content layer translates left via translateX revealing the action buttons behind
  3. Dragging beyond a threshold snaps the item open; releasing early snaps it closed
  4. Tapping an action button (Archive / Delete) animates the item out of the list

Features

  • Swipe one item at a time — opening a new item automatically closes the previous
  • Archive button slides the item out upward; Delete removes it immediately
  • Works with both touch and mouse/pointer events

When to use it

  • Email or notification inboxes
  • Todo lists with swipe-to-complete
  • Any list where quick actions improve the flow