
The layered button
Buttons, Hover, Physics
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.
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>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
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 siteEach 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.
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 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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
OPEN | script.js | 148 | How far a row stays open to show Snooze and Archive, in pixels. |
FULL | script.js | 0.56 | Past this share of the row Archive takes the whole width. |
STIFFNESS | script.js | 520 | The strength of the spring that brings the row back, opens or closes it. |
DAMPING | script.js | 0.8 | 1 is no bounce, lower bounces more. |
PROJECT | script.js | 0.12 | How much the speed of the flick counts when you let go, in seconds. |
UNREAD | script.js | 12 | The unread count at the top. |
TOAST_TIME | script.js | 4 | The seconds the Undo toast stays. |
AUTOPLAY | script.js | true | A fake pointer shows the gestures until you touch the list. |
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.
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.
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.
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.
Tested on 24 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.