
The elastic button
Buttons, Hover, Text
The inbox of an app, on a very light grey: archiving a conversation slides the row away to the side and the list closes up on a spring, and from the bottom a dark Conversation archived toast rises with a thin ring that runs down in five seconds around the seconds left, and an Undo button. Undoing brings the row back to its place as the list opens again; archive two and the toasts stack up, and under the pointer the stack opens and the rings stop.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React tab holds the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Undo countdown toast" 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 undo toast with a countdown</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 inbox of a mail app: archiving a row slides it away, the list closes up, and an undo toast rises
with a thin ring that runs down in five seconds around the number of seconds left -->
<section class="inbox" data-inbox aria-label="Postwick inbox">
<header class="inbox__head">
<div>
<h1 class="inbox__title">Inbox</h1>
<p class="inbox__count" data-count>5 conversations</p>
</div>
<span class="inbox__app">Postwick</span>
</header>
<ul class="list" data-list>
<li class="row" data-row data-name="Ines Calder">
<span class="row__avatar" style="--tint:#e9e4ff;--ink:#5b4bd1">IC</span>
<span class="row__body">
<span class="row__top"><strong class="row__name">Ines Calder</strong><time class="row__time">9:41</time></span>
<span class="row__subject">Spring catalogue proofs, last round</span>
</span>
<button class="row__archive" type="button" data-archive aria-label="Archive conversation with Ines Calder">
<svg viewBox="0 0 20 20" aria-hidden="true"><path class="lid" d="M3.5 4.8h13v3h-13z"></path><path d="M4.6 7.8v6.6a1.6 1.6 0 0 0 1.6 1.6h7.6a1.6 1.6 0 0 0 1.6-1.6V7.8M8.2 10.8h3.6"></path></svg>
</button>
</li>
<li class="row" data-row data-name="Theo Marsh">
<span class="row__avatar" style="--tint:#dff3ea;--ink:#2f7d5b">TM</span>
<span class="row__body">
<span class="row__top"><strong class="row__name">Theo Marsh</strong><time class="row__time">9:12</time></span>
<span class="row__subject">Invoice 2207 for October is ready</span>
</span>
<button class="row__archive" type="button" data-archive aria-label="Archive conversation with Theo Marsh">
<svg viewBox="0 0 20 20" aria-hidden="true"><path class="lid" d="M3.5 4.8h13v3h-13z"></path><path d="M4.6 7.8v6.6a1.6 1.6 0 0 0 1.6 1.6h7.6a1.6 1.6 0 0 0 1.6-1.6V7.8M8.2 10.8h3.6"></path></svg>
</button>
</li>
<li class="row" data-row data-name="Ravi Anand">
<span class="row__avatar" style="--tint:#ffeedd;--ink:#b4612a">RA</span>
<span class="row__body">
<span class="row__top"><strong class="row__name">Ravi Anand</strong><time class="row__time">Yesterday</time></span>
<span class="row__subject">Can we move Thursday’s review to 3:30?</span>
</span>
<button class="row__archive" type="button" data-archive aria-label="Archive conversation with Ravi Anand">
<svg viewBox="0 0 20 20" aria-hidden="true"><path class="lid" d="M3.5 4.8h13v3h-13z"></path><path d="M4.6 7.8v6.6a1.6 1.6 0 0 0 1.6 1.6h7.6a1.6 1.6 0 0 0 1.6-1.6V7.8M8.2 10.8h3.6"></path></svg>
</button>
</li>
<li class="row" data-row data-name="June Holloway">
<span class="row__avatar" style="--tint:#e2efff;--ink:#2e64b8">JH</span>
<span class="row__body">
<span class="row__top"><strong class="row__name">June Holloway</strong><time class="row__time">Yesterday</time></span>
<span class="row__subject">Your trial ends in three days</span>
</span>
<button class="row__archive" type="button" data-archive aria-label="Archive conversation with June Holloway">
<svg viewBox="0 0 20 20" aria-hidden="true"><path class="lid" d="M3.5 4.8h13v3h-13z"></path><path d="M4.6 7.8v6.6a1.6 1.6 0 0 0 1.6 1.6h7.6a1.6 1.6 0 0 0 1.6-1.6V7.8M8.2 10.8h3.6"></path></svg>
</button>
</li>
<li class="row" data-row data-name="Pablo Reyes">
<span class="row__avatar" style="--tint:#fbe4ee;--ink:#b23d6e">PR</span>
<span class="row__body">
<span class="row__top"><strong class="row__name">Pablo Reyes</strong><time class="row__time">Mon</time></span>
<span class="row__subject">Photos from the offsite, all 84 of them</span>
</span>
<button class="row__archive" type="button" data-archive aria-label="Archive conversation with Pablo Reyes">
<svg viewBox="0 0 20 20" aria-hidden="true"><path class="lid" d="M3.5 4.8h13v3h-13z"></path><path d="M4.6 7.8v6.6a1.6 1.6 0 0 0 1.6 1.6h7.6a1.6 1.6 0 0 0 1.6-1.6V7.8M8.2 10.8h3.6"></path></svg>
</button>
</li>
</ul>
</section>
<div class="toasts" data-toasts aria-live="polite"></div>
<template data-toast-tpl>
<div class="toast" role="status">
<span class="toast__ring">
<svg viewBox="0 0 24 24" aria-hidden="true">
<circle class="ring__track" cx="12" cy="12" r="9"></circle>
<circle class="ring__run" cx="12" cy="12" r="9"></circle>
</svg>
<span class="toast__num" data-num><span class="num__cur">5</span></span>
</span>
<span class="toast__text">
<strong data-msg>Conversation archived</strong>
<span class="toast__who" data-who></span>
</span>
<button class="toast__undo" type="button" data-undo>
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M7.4 5.2 4.4 8.2l3 3M4.8 8.2h6.6a4 4 0 0 1 0 8H9"></path></svg>
<span data-undo-label>Undo</span>
</button>
</div>
</template>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></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.
49 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 “Undo countdown toast” from Animorio and fit it into my siteBefore removing a row, the position of every other row (getBoundingClientRect) and the height of the list are noted; then the row gets display none, and each remaining row starts from its old place with a y equal to the difference and goes back to zero with back.out. The list’s height also goes from old to new, so the card shortens with the rows. Putting a row back does the same in reverse.
The ring is an SVG circle of radius 9 with a round cap: stroke-dasharray is the circumference, and a linear GSAP tween lasting TOAST_SECONDS takes stroke-dashoffset from zero to the full circumference. On each update the seconds left are worked out; when they change, the old digit leaves upwards and the new one rises from below. Under 1.6 seconds the stroke turns amber.
Open toasts live in a list: the newest in front, the others behind, each higher by STACK_GAP pixels, 5% smaller and more transparent. Under the pointer the stack opens: each toast rises by a full height plus 8 pixels and returns to full size, and the rings’ tweens are paused with pause(), to carry on from where they were with resume().
Undo stops its ring’s tween, sends the toast away and puts the row back at its index: rows never leave the DOM, they only change class, so the order stays right even when undoing the first of two. The row comes back in from the right on a spring with a lilac glow fading out in a second. Ctrl Z or Cmd Z undo the last one too.
| Name | File | Default | What it changes |
|---|---|---|---|
TOAST_SECONDS | script.js | 5 | The seconds in which you can still undo. |
MESSAGE | script.js | Conversation archived | The toast’s message. |
UNDO_LABEL | script.js | Undo | The label of the undo button. |
SPRING | script.js | 1.4 | How much the rows and toasts bounce as they settle. |
STACK_GAP | script.js | 10 | How many pixels each toast peeks out behind the other in the closed stack. |
ACCENT | script.js | #9aa6ff | The colour of the ring running down. |
For any action that can still be undone: archiving or deleting a message, removing a product from the cart, moving a file to the bin, marking a task as done. The undo toast avoids a confirmation dialog and lets people work fast.
The card and the toast narrow to the screen’s width, the rows are also measured on the height (between 44 and 60 pixels) and everything fits in the box. Without a mouse the archive button always shows, at half light, in place of the time; a tap archives and undoes like a click.
No sliding and no bouncing: the row fades and the list closes up at once, the toasts appear and leave with a fade and in the stack they are already in place. The ring still runs down and the digit changes without rolling.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.7 KB; the libraries: GSAP 28 KB.
Tested on 25 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.