Skip to content
animorio
IT
All components

Swipe to delete row

Lists, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

People searched for “swipe to delete” and there was no real list with Delete: here is the conversation list of a made-up messaging app, Relay, alone on white. A row drags with the finger or the pointer: to the left Archive, dark, and Delete, red, come out from under it, deepening as you pull; past the threshold Delete takes the whole row with a small snap and the bin lid lifts. Let go earlier and it springs home or rests open on the two buttons; to the right Pin comes out on a rubber band. The deleted row slides off, the rows below rise one after another to close the gap and “Conversation deleted · Undo” arrives at the bottom with a thread that burns down; Undo opens the gap again and the row comes back. Minimal style.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Swipe to delete row" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Swipe to delete row</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the conversation list of a made-up messaging app, Relay: drag a row to the left and Archive and Delete come out
         from under it, keep pulling and Delete takes the whole row; drag it to the right and Pin comes out.
         A deleted row slides away, the rows below close the gap and a toast offers Undo -->
    <div class="wrap" data-wrap>
      <section class="card" data-card aria-labelledby="ms-title">
        <header class="head">
          <h2 class="head__title" id="ms-title">Messages</h2>
          <span class="head__count"><span data-count>5</span> chats</span>
          <button class="head__new" type="button" aria-label="New message">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M11.8 4.4l3.8 3.8M4.2 15.8l1-3.9 8.3-8.3a1.6 1.6 0 0 1 2.3 0l.4.4a1.6 1.6 0 0 1 0 2.3l-8.3 8.3z"></path></svg>
          </button>
        </header>

        <ul class="list" data-list aria-label="Conversations">
          <li class="row is-unread" data-row data-name="Maya Okafor">
            <div class="under" aria-hidden="false">
              <button class="act act--pin" type="button" data-act="pin" tabindex="-1" aria-label="Pin Maya Okafor"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="pin__head" d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path><path d="M6.6 13.4l-3.2 3.2"></path></svg><span class="act__label" data-pin-label>Pin</span></span></button>
              <button class="act act--archive" type="button" data-act="archive" tabindex="-1" aria-label="Archive Maya Okafor"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="box__lid" d="M3.2 4.6h13.6v3H3.2z"></path><path d="M4.4 7.6v7.2a1.4 1.4 0 0 0 1.4 1.4h8.4a1.4 1.4 0 0 0 1.4-1.4V7.6M8.2 10.6h3.6"></path></svg><span class="act__label">Archive</span></span></button>
              <button class="act act--delete" type="button" data-act="delete" tabindex="-1" aria-label="Delete Maya Okafor"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><g class="bin__lid"><path d="M3.4 5.4h13.2M8 5.4V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.4"></path></g><path d="M5 5.4l.8 10.2a1.4 1.4 0 0 0 1.4 1.3h5.6a1.4 1.4 0 0 0 1.4-1.3L15 5.4M8.4 8.6v5M11.6 8.6v5"></path></svg><span class="act__label">Delete</span></span></button>
            </div>
            <div class="face" data-face tabindex="0" role="group" aria-label="Maya Okafor, Sure, I will send the deck over tonight. Swipe or use arrow keys for actions">
              <span class="ava" style="--ava: #ece4da; --ava-ink: #7a6247">MO</span>
              <span class="txt">
                <span class="txt__top"><span class="txt__name">Maya Okafor</span><svg class="pinned" viewBox="0 0 20 20" aria-hidden="true"><path d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path></svg><span class="txt__time">9:41</span></span>
                <span class="txt__prev">Sure, I&rsquo;ll send the deck over tonight</span>
              </span>
            </div>
          </li>
          <li class="row is-unread" data-row data-name="Studio Lumen">
            <div class="under">
              <button class="act act--pin" type="button" data-act="pin" tabindex="-1" aria-label="Pin Studio Lumen"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="pin__head" d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path><path d="M6.6 13.4l-3.2 3.2"></path></svg><span class="act__label" data-pin-label>Pin</span></span></button>
              <button class="act act--archive" type="button" data-act="archive" tabindex="-1" aria-label="Archive Studio Lumen"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="box__lid" d="M3.2 4.6h13.6v3H3.2z"></path><path d="M4.4 7.6v7.2a1.4 1.4 0 0 0 1.4 1.4h8.4a1.4 1.4 0 0 0 1.4-1.4V7.6M8.2 10.6h3.6"></path></svg><span class="act__label">Archive</span></span></button>
              <button class="act act--delete" type="button" data-act="delete" tabindex="-1" aria-label="Delete Studio Lumen"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><g class="bin__lid"><path d="M3.4 5.4h13.2M8 5.4V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.4"></path></g><path d="M5 5.4l.8 10.2a1.4 1.4 0 0 0 1.4 1.3h5.6a1.4 1.4 0 0 0 1.4-1.3L15 5.4M8.4 8.6v5M11.6 8.6v5"></path></svg><span class="act__label">Delete</span></span></button>
            </div>
            <div class="face" data-face tabindex="0" role="group" aria-label="Studio Lumen, Leo: final cut is up in the shared folder. Swipe or use arrow keys for actions">
              <span class="ava ava--group" style="--ava: #e4e7ec; --ava-ink: #4f5866"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="7.4" cy="7.6" r="2.4"></circle><circle cx="13.4" cy="8.4" r="1.9"></circle><path d="M3.2 15.2c.5-2.4 2.2-3.7 4.2-3.7s3.7 1.3 4.2 3.7M12 11.6c1.9-.2 3.6.9 4.1 3"></path></svg></span>
              <span class="txt">
                <span class="txt__top"><span class="txt__name">Studio Lumen</span><svg class="pinned" viewBox="0 0 20 20" aria-hidden="true"><path d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path></svg><span class="txt__time">9:12</span></span>
                <span class="txt__prev">Leo: Final cut is up in the shared folder</span>
              </span>
            </div>
          </li>
          <li class="row" data-row data-name="Jonas Weber">
            <div class="under">
              <button class="act act--pin" type="button" data-act="pin" tabindex="-1" aria-label="Pin Jonas Weber"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="pin__head" d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path><path d="M6.6 13.4l-3.2 3.2"></path></svg><span class="act__label" data-pin-label>Pin</span></span></button>
              <button class="act act--archive" type="button" data-act="archive" tabindex="-1" aria-label="Archive Jonas Weber"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="box__lid" d="M3.2 4.6h13.6v3H3.2z"></path><path d="M4.4 7.6v7.2a1.4 1.4 0 0 0 1.4 1.4h8.4a1.4 1.4 0 0 0 1.4-1.4V7.6M8.2 10.6h3.6"></path></svg><span class="act__label">Archive</span></span></button>
              <button class="act act--delete" type="button" data-act="delete" tabindex="-1" aria-label="Delete Jonas Weber"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><g class="bin__lid"><path d="M3.4 5.4h13.2M8 5.4V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.4"></path></g><path d="M5 5.4l.8 10.2a1.4 1.4 0 0 0 1.4 1.3h5.6a1.4 1.4 0 0 0 1.4-1.3L15 5.4M8.4 8.6v5M11.6 8.6v5"></path></svg><span class="act__label">Delete</span></span></button>
            </div>
            <div class="face" data-face tabindex="0" role="group" aria-label="Jonas Weber, Are we still on for Thursday? Swipe or use arrow keys for actions">
              <span class="ava" style="--ava: #e3ebe5; --ava-ink: #4d6b57">JW</span>
              <span class="txt">
                <span class="txt__top"><span class="txt__name">Jonas Weber</span><svg class="pinned" viewBox="0 0 20 20" aria-hidden="true"><path d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path></svg><span class="txt__time">8:30</span></span>
                <span class="txt__prev">Are we still on for Thursday?</span>
              </span>
            </div>
          </li>
          <li class="row" data-row data-name="Priya Raman">
            <div class="under">
              <button class="act act--pin" type="button" data-act="pin" tabindex="-1" aria-label="Pin Priya Raman"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="pin__head" d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path><path d="M6.6 13.4l-3.2 3.2"></path></svg><span class="act__label" data-pin-label>Pin</span></span></button>
              <button class="act act--archive" type="button" data-act="archive" tabindex="-1" aria-label="Archive Priya Raman"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="box__lid" d="M3.2 4.6h13.6v3H3.2z"></path><path d="M4.4 7.6v7.2a1.4 1.4 0 0 0 1.4 1.4h8.4a1.4 1.4 0 0 0 1.4-1.4V7.6M8.2 10.6h3.6"></path></svg><span class="act__label">Archive</span></span></button>
              <button class="act act--delete" type="button" data-act="delete" tabindex="-1" aria-label="Delete Priya Raman"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><g class="bin__lid"><path d="M3.4 5.4h13.2M8 5.4V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.4"></path></g><path d="M5 5.4l.8 10.2a1.4 1.4 0 0 0 1.4 1.3h5.6a1.4 1.4 0 0 0 1.4-1.3L15 5.4M8.4 8.6v5M11.6 8.6v5"></path></svg><span class="act__label">Delete</span></span></button>
            </div>
            <div class="face" data-face tabindex="0" role="group" aria-label="Priya Raman, Thanks! The keys are with the concierge. Swipe or use arrow keys for actions">
              <span class="ava" style="--ava: #f0e6e8; --ava-ink: #8a5560">PR</span>
              <span class="txt">
                <span class="txt__top"><span class="txt__name">Priya Raman</span><svg class="pinned" viewBox="0 0 20 20" aria-hidden="true"><path d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path></svg><span class="txt__time">Yesterday</span></span>
                <span class="txt__prev">Thanks! The keys are with the concierge</span>
              </span>
            </div>
          </li>
          <li class="row" data-row data-name="Theo Lindqvist">
            <div class="under">
              <button class="act act--pin" type="button" data-act="pin" tabindex="-1" aria-label="Pin Theo Lindqvist"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="pin__head" d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path><path d="M6.6 13.4l-3.2 3.2"></path></svg><span class="act__label" data-pin-label>Pin</span></span></button>
              <button class="act act--archive" type="button" data-act="archive" tabindex="-1" aria-label="Archive Theo Lindqvist"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="box__lid" d="M3.2 4.6h13.6v3H3.2z"></path><path d="M4.4 7.6v7.2a1.4 1.4 0 0 0 1.4 1.4h8.4a1.4 1.4 0 0 0 1.4-1.4V7.6M8.2 10.6h3.6"></path></svg><span class="act__label">Archive</span></span></button>
              <button class="act act--delete" type="button" data-act="delete" tabindex="-1" aria-label="Delete Theo Lindqvist"><span class="act__fill"></span><span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><g class="bin__lid"><path d="M3.4 5.4h13.2M8 5.4V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.4"></path></g><path d="M5 5.4l.8 10.2a1.4 1.4 0 0 0 1.4 1.3h5.6a1.4 1.4 0 0 0 1.4-1.3L15 5.4M8.4 8.6v5M11.6 8.6v5"></path></svg><span class="act__label">Delete</span></span></button>
            </div>
            <div class="face" data-face tabindex="0" role="group" aria-label="Theo Lindqvist, Photo. Swipe or use arrow keys for actions">
              <span class="ava" style="--ava: #ebe8f1; --ava-ink: #62587e">TL</span>
              <span class="txt">
                <span class="txt__top"><span class="txt__name">Theo Lindqvist</span><svg class="pinned" viewBox="0 0 20 20" aria-hidden="true"><path d="M12.6 3.2l4.2 4.2-2.5 1.1-2.9 2.9.4 3.3-1.2 1.2-6.6-6.6 1.2-1.2 3.3.4 2.9-2.9z"></path></svg><span class="txt__time">Mon</span></span>
                <span class="txt__prev"><svg class="txt__ico" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3.2" width="12" height="9.6" rx="2"></rect><path d="M2.6 11.2l3.4-3.4 2.6 2.6 1.6-1.6 3.2 3.2"></path></svg>Photo</span>
              </span>
            </div>
          </li>
        </ul>

        <div class="empty" data-empty aria-hidden="true">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4.5 12.8l4.4 4.4L19.5 6.6"></path></svg>
          <span>All caught up</span>
          <button type="button" class="empty__btn" data-restore>Restore chats</button>
        </div>

        <div class="toast" data-toast role="status" aria-hidden="true">
          <span class="toast__text"><span data-toast-text>Conversation deleted</span><span class="toast__sep" aria-hidden="true">&middot;</span></span>
          <button class="toast__undo" type="button" data-undo tabindex="-1">
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.6 4.2L3 6.8l2.6 2.6M3.4 6.8h6a3.4 3.4 0 0 1 0 6.8H7.6"></path></svg>Undo
          </button>
          <span class="toast__fuse" data-fuse aria-hidden="true"></span>
        </div>
      </section>

      <!-- the drawn pointer of the self-running tour -->
      <svg class="hand" data-hand viewBox="0 0 24 24" aria-hidden="true"><path d="M5.2 3.4l13.4 7.2-6 1.4-2.8 5.8z"></path></svg>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </main>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

77 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Swipe to delete row” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white background, a white card with a soft layered shadow and a thread of light along the top edge: “Messages” with “5 chats” beside it and the compose pencil, then five conversations of a made-up messaging app, each with a round avatar with initials in a soft tint (the group has a two-person icon), the name, a one-line preview and the time; unread ones have a heavier name, no dots. A row drags sideways: it follows the finger, casts a small shadow on its edge and, to the left, Archive and Delete come out from under it sharing the gap, their colour going from pale grey and soft pink to dark grey and full red and their icons growing; the box lid lifts slightly. Past 60% of the row Delete swallows Archive with a snap and a few pixels of bounce, its icon rides the edge of the row and the bin lid opens. Let go and the row slides off with the speed of the gesture, the red fades, the rows below rise one after another with a pixel of bounce, the chat count rolls down and the dark toast “Conversation deleted · Undo” arrives from the bottom with a white thread burning down. Let go before the threshold and the row springs home or, past half the buttons, rests open on Archive and Delete; to the right Pin comes out on a rubber band and, past the point, the pin tilts and a small pin appears next to the name. Undo opens the gap again, the rows below drop to make room and the row slides back on a spring. On its own a drawn pointer makes a short pull that springs back, opens a row and taps Archive, drags another all the way to Delete and taps Undo.

How it works

Two layers per row

Each row has the three real buttons underneath (Pin on the left, Archive and Delete on the right) and the white face on top, moved with translate3d. The button widths are worked out every frame from x: Archive and Delete share the uncovered gap, and a full factor from 0 to 1 gives it all to Delete.

The gesture decided after six pixels

With Pointer Events the row waits: if the finger moves more vertically than sideways the page scrolls (touch-action pan-y), if it moves six pixels sideways it captures the pointer and the row takes the movement. Past Pin’s limit the distance goes through a rubber-band curve.

A spring integrated by hand

On release the speed of the last 90 milliseconds projects the landing point (PROJECT) and decides: delete, stay open or go home. The spring is integrated every frame with stiffness and damping, so it starts with the finger’s real speed; the step is capped at 1/30 of a second.

The threshold with a snap

When the row passes FULL, GSAP takes full to 1 with back.out and gives the face a five-pixel knock that settles with elastic.out; the bin lid turns 24 degrees on its hinge. Going back under the threshold it all returns.

Closing the gap and undoing

The deleted row slides out, then the rows below rise by one row height with back.out and a stagger (STAGGER); when done the row goes to display none and the others go back to y 0 with no jump. Undo does the reverse: the row returns to the flow, the others start one row higher and drop, and the face comes back in from the left on the spring.

Values to change

NameFileDefaultWhat it changes
OPENscript.js140How far a row stays open to show Archive and Delete, in pixels.
FULLscript.js0.6The share of the row past which Delete takes it all and letting go deletes.
PIN_ATscript.js84How far to pull right to pin the chat, in pixels.
STIFFNESSscript.js430The stiffness of the spring that brings the row back or opens it.
DAMPINGscript.js0.72The spring’s damping: 1 no bounce, lower bounces more.
PROJECTscript.js0.1How much the flick’s speed counts on release, in seconds.
STAGGERscript.js0.05The delay between the rows that close the gap.
TOAST_TIMEscript.js4.5How many seconds the Undo toast stays.
LOOP_PAUSEscript.js1.6The pause before the self-running tour starts again.
AUTOPLAYscript.jstrueThe drawn pointer shows the gestures until you touch the list.

Try them in the Playground

When to use it

In the message or email list of an app, in the tasks of a productivity app, in notifications, in a shop’s cart on a phone, in any list where a row is archived, deleted or pinned with a gesture and an undo is needed.

On phones

The card takes the width with a margin and the row height also follows the screen height with clamp, so the five rows and the toast fit the phone preview box. Widths are measured again on resize. With a finger the gesture lets the page scroll vertically (touch-action pan-y) and only takes the sideways one.

With reduced motion

No slides or springs: one row is already open on Archive and Delete, the self-running tour does not start, a release puts the row straight in place, a deleted row fades out and the others are already in place, the toast fades in and its thread stays still.

Pitfalls

  • When the row slides out, Delete is wider than the row and the icon riding its edge got cut off on the left: the icon’s position never goes below the visible part of the cell.
  • With the deleted row hidden, the divider stayed at the top of the new first row because the “.row + .row” selector also counts hidden rows: the first visible row gets a class and the line is removed there.
  • The rows closing the gap rise with a transform: at the end the deleted row goes to display none and the transforms go back to zero in the same frame, so there is no jump.
  • The list has the fixed height of five rows, otherwise the card centred on the page jumped up at every deleted row; the toast arrives in the space freed at the bottom.
  • A spring step that was too long, when the tab became visible again, made the row blow up: the step is capped at 1/30 of a second.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.

Testing

Tested on 22 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components