Skip to content
animorio
IT
All components

Swipe actions inbox

Lists, Physics, HoverGSAPMediumCompressed weight: Demo 9.8 KBGSAP 28 KBFreeDownload the zip

A small inbox on white, four rows. Drag a row to the left and Snooze and Archive come out from under it, their icons growing; let go halfway and the row springs open on the two actions. Drag further and Archive takes the whole row, its icon riding the edge with a small knock, like a haptic tick; let go and the row flies off, the others rise to close the gap, the unread count rolls down and a toast offers Undo.

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 actions inbox" 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>The swipe actions inbox</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" data-stage>
    <!-- the swipe actions inbox: a small inbox card on white. Swipe a row to the left and two actions come out from
         under it, Snooze and Archive; swipe far enough and Archive takes the whole row, let go and the row flies off,
         the rows below close the gap and a toast offers Undo -->
    <div class="wrap" data-wrap>
    <section class="inbox" data-inbox aria-label="Inbox">
      <header class="inbox__head">
        <h1 class="inbox__title">Inbox</h1>
        <p class="inbox__count"><span class="roll" data-count aria-hidden="true"></span><span>unread</span><span class="sr" data-count-sr></span></p>
      </header>
      <ul class="inbox__list" data-list>
        <li class="row" data-row>
          <div class="row__acts" data-acts>
            <button class="act act--snooze" type="button" tabindex="-1" data-act="snooze">
              <span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="11" r="6.2"/><path d="M10 7.9v3.3l2.1 1.4M4.6 3.9 2.9 5.4M15.4 3.9l1.7 1.5"/></svg><span class="act__label">Snooze</span></span>
            </button>
            <button class="act act--archive" type="button" tabindex="-1" data-act="archive">
              <span class="act__in" data-archive-in><svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="3.6" width="14.4" height="3.6" rx="1.1"/><path d="M4.1 7.2v7.4c0 .9.7 1.6 1.6 1.6h8.6c.9 0 1.6-.7 1.6-1.6V7.2M8.2 10.4h3.6"/></svg><span class="act__label">Archive</span></span>
            </button>
          </div>
          <div class="row__card" data-card tabindex="0" aria-label="Maya Okafor, Q4 roadmap review, 9:41">
            <span class="ava" aria-hidden="true">MO</span>
            <span class="row__body">
              <span class="row__top"><span class="row__from">Maya Okafor</span><span class="row__time">9:41</span></span>
              <span class="row__subj">Q4 roadmap review</span>
              <span class="row__prev">Moved the sync to Thursday, notes are in the doc.</span>
            </span>
          </div>
        </li>
        <li class="row" data-row>
          <div class="row__acts" data-acts>
            <button class="act act--snooze" type="button" tabindex="-1" data-act="snooze">
              <span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="11" r="6.2"/><path d="M10 7.9v3.3l2.1 1.4M4.6 3.9 2.9 5.4M15.4 3.9l1.7 1.5"/></svg><span class="act__label">Snooze</span></span>
            </button>
            <button class="act act--archive" type="button" tabindex="-1" data-act="archive">
              <span class="act__in" data-archive-in><svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="3.6" width="14.4" height="3.6" rx="1.1"/><path d="M4.1 7.2v7.4c0 .9.7 1.6 1.6 1.6h8.6c.9 0 1.6-.7 1.6-1.6V7.2M8.2 10.4h3.6"/></svg><span class="act__label">Archive</span></span>
            </button>
          </div>
          <div class="row__card" data-card tabindex="0" aria-label="Lumen Billing, Invoice INV-2207 is ready, 8:15">
            <span class="ava" aria-hidden="true">LB</span>
            <span class="row__body">
              <span class="row__top"><span class="row__from">Lumen Billing</span><span class="row__time">8:15</span></span>
              <span class="row__subj">Invoice INV-2207 is ready</span>
              <span class="row__prev">$1,240.00 due on Nov 14. Paid by card ending 4021.</span>
            </span>
          </div>
        </li>
        <li class="row is-read" data-row>
          <div class="row__acts" data-acts>
            <button class="act act--snooze" type="button" tabindex="-1" data-act="snooze">
              <span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="11" r="6.2"/><path d="M10 7.9v3.3l2.1 1.4M4.6 3.9 2.9 5.4M15.4 3.9l1.7 1.5"/></svg><span class="act__label">Snooze</span></span>
            </button>
            <button class="act act--archive" type="button" tabindex="-1" data-act="archive">
              <span class="act__in" data-archive-in><svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="3.6" width="14.4" height="3.6" rx="1.1"/><path d="M4.1 7.2v7.4c0 .9.7 1.6 1.6 1.6h8.6c.9 0 1.6-.7 1.6-1.6V7.2M8.2 10.4h3.6"/></svg><span class="act__label">Archive</span></span>
            </button>
          </div>
          <div class="row__card" data-card tabindex="0" aria-label="Theo Lindqvist, Design crit moved, Yesterday">
            <span class="ava" aria-hidden="true">TL</span>
            <span class="row__body">
              <span class="row__top"><span class="row__from">Theo Lindqvist</span><span class="row__time">Yesterday</span></span>
              <span class="row__subj">Design crit moved</span>
              <span class="row__prev">Same room, half an hour later. Bring the onboarding flow.</span>
            </span>
          </div>
        </li>
        <li class="row is-read" data-row>
          <div class="row__acts" data-acts>
            <button class="act act--snooze" type="button" tabindex="-1" data-act="snooze">
              <span class="act__in"><svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="11" r="6.2"/><path d="M10 7.9v3.3l2.1 1.4M4.6 3.9 2.9 5.4M15.4 3.9l1.7 1.5"/></svg><span class="act__label">Snooze</span></span>
            </button>
            <button class="act act--archive" type="button" tabindex="-1" data-act="archive">
              <span class="act__in" data-archive-in><svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="3.6" width="14.4" height="3.6" rx="1.1"/><path d="M4.1 7.2v7.4c0 .9.7 1.6 1.6 1.6h8.6c.9 0 1.6-.7 1.6-1.6V7.2M8.2 10.4h3.6"/></svg><span class="act__label">Archive</span></span>
            </button>
          </div>
          <div class="row__card" data-card tabindex="0" aria-label="Orrin Studio, Your export finished, Mon">
            <span class="ava" aria-hidden="true">OS</span>
            <span class="row__body">
              <span class="row__top"><span class="row__from">Orrin Studio</span><span class="row__time">Mon</span></span>
              <span class="row__subj">Your export finished</span>
              <span class="row__prev">48 frames, 1080 by 1350, ready to download for 7 days.</span>
            </span>
          </div>
        </li>
      </ul>
      <p class="inbox__empty" data-empty aria-hidden="true">You’re all caught up</p>
    </section>

    <div class="toast" data-toast role="status" aria-live="polite">
      <span class="toast__text" data-toast-text>Archived</span>
      <button class="toast__undo" type="button" data-undo>Undo</button>
    </div>
    </div>

    <svg class="hand" data-hand viewBox="0 0 24 24" aria-hidden="true"><path d="M5.2 2.6v15.6l4.1-3.7 2.6 6 2.7-1.2-2.6-5.9 5.5-.4Z"/></svg>
  </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.

50 values to change

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 actions inbox” 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 page a white card with wide corners, a hairline border and a soft shadow: at the top Inbox and the unread count, 12 unread, below four mail rows with initials in a grey circle, the sender, the time, the subject and the start of the message; the two rows already read have a lighter name. A fake pointer shows the gesture: it takes the first row and drags it to the left, and two actions come out from under it, Snooze in grey and Archive in blue, their drawn icons growing as they show and a thin shadow on the edge of the row as it lifts off. Let go, the row springs back a little and stays open on the two actions; a tap closes it. Then the pointer flings the second row past halfway: Archive swallows Snooze and takes the whole width, its icon leaves the middle and rides the edge of the row with a small knock, like a haptic tick; the row flies off, the rows below rise to close the gap and settle by a pixel, the 12 rolls to 11 and a black Archived toast with Undo arrives at the bottom, bringing it back. Dragged to the right the row only stretches a little, like a rubber band.

How it works

A spring written by hand

Each row has a position and a speed. On every frame, in steps of a two hundred fortieth of a second, the acceleration is minus STIFFNESS times the distance from the target minus the damping times the speed, with the damping equal to two times the square root of STIFFNESS times DAMPING. So when you let go, the row’s speed goes into the spring: a flick arrives faster and swings a little, a slow release settles gently.

The release looks ahead

While you drag, the positions of the last 90 milliseconds are kept and the speed comes from them. On release the position is projected forward by the speed times PROJECT: past 78 per cent of the row it archives, past half of OPEN it opens, otherwise it closes. A quick flick of a few centimetres is enough to open.

The actions that show

The two actions sit under the row, pinned to the right, and their width is how much of it the row has uncovered: half each. Past FULL, a number from 0 to 1 moved by GSAP grows Archive to the whole space and closes Snooze; the Archive icon leaves the middle and stays 46 pixels from the edge of the row. As it arrives the icon swells by 16 per cent and comes back on an elastic: that is the knock.

The rubber band and the row that leaves

Past the edges the row follows a curve that slows down, one minus one over one plus the distance times 0.55 over the size, like scrolling on a phone. Archived, the row flies on a spring with no bounce, then its height goes to zero and the rows below rise, settle by a pixel and the counter rolls: each digit is a column from 0 to 9 behind a window one line tall.

Accessible

Every row can be reached with Tab: the left arrow opens it and puts Snooze and Archive in the Tab order, the right arrow or Esc closes it, Delete or E archives it. The toast is a live region that announces Archived and the unread count is also written out for screen readers. With reduced motion the fake pointer does not start, rows go to their place without springs and the toast fades in.

Values to change

NameFileDefaultWhat it changes
OPENscript.js148How far a row stays open to show Snooze and Archive, in pixels.
FULLscript.js0.56Past this share of the row Archive takes the whole width.
STIFFNESSscript.js520The strength of the spring that brings the row back, opens or closes it.
DAMPINGscript.js0.81 is no bounce, lower bounces more.
PROJECTscript.js0.12How much the speed of the flick counts when you let go, in seconds.
UNREADscript.js12The unread count at the top.
TOAST_TIMEscript.js4The seconds the Undo toast stays.
AUTOPLAYscript.jstrueA fake pointer shows the gestures until you touch the list.

Try them in the Playground

When to use it

For any list to clear with one gesture: the mail of an app, a dashboard’s notifications, the tasks of a team tool, customer service messages, the orders to ship in a shop.

On phones

The card narrows to 16 pixels from the edges, the rows cut the subject and the preview with an ellipsis. With a finger the gesture is the same: the row only moves once the finger goes more sideways than down, so the page still scrolls vertically.

With reduced motion

The fake pointer does not start, rows go to their place without springs, an archived row disappears without flying off and the toast fades in.

Pitfalls

  • The gesture has to be decided before capturing the pointer: until the finger has moved 6 pixels there is no telling whether it wants to scroll the page or the row. With touch-action pan-y the page scrolls vertically and the row only takes the sideways movement.
  • A GSAP spring knows nothing about the finger’s speed: starting from rest, a flick felt like a slow release. Integrated by hand, the spring gets the real speed and the row carries the gesture on.
  • The card changes height when a row goes, and centred on the page it jumped up: the wrapper keeps the height of the full card and the toast arrives in the freed space.
  • No blue dot for unread messages (a rule of the site): you read it from the weight of the name and the subject.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 24 October 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