Skip to content
animorio
IT
All components

Archive all button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

The Archive all button of a mail app, on white, with the stack of unread emails above it and the count in the pill. Pressed, the lid of the drawn box opens and the six emails drop in one after another, shrinking and turning slightly; the others move forward in the stack on a spring, the box takes every blow and the number rolls down to zero. Then the label becomes Inbox zero, a tick is drawn on the box, «You’re all caught up» appears above and Undo slides out beside it with a line counting the seconds: pressed, the emails climb back out of the box in the same order.

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>
<!--
  "Archive all button" 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 Archive all button with the emails dropping one by one into the box</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">
    <!-- one gesture: press. A small stack of unread emails sits on the Archive all button: pressed, the lid of the box
         opens and the emails drop in one by one, the count rolls down to zero, the label becomes Inbox zero with a tick
         drawn on the box; Undo slides out next to it with a thin line counting down -->
    <section class="pezzo" data-pezzo aria-label="Archive all unread emails">
      <div class="pila" data-pila aria-hidden="true">
        <p class="vuoto" data-vuoto>You’re all caught up</p>
      </div>
      <div class="fila">
        <button class="tasto" type="button" data-tasto>
          <span class="tasto__corpo" data-corpo>
            <svg class="scatola" data-scatola viewBox="0 0 24 24" aria-hidden="true">
              <g class="fondo" data-fondo>
                <path d="M5 10.6h14v7.6a2.2 2.2 0 0 1-2.2 2.2H7.2A2.2 2.2 0 0 1 5 18.2Z"></path>
                <path class="maniglia" data-maniglia d="M10.2 14.1h3.6"></path>
                <path class="spunta" data-spunta d="M9.3 15.4l1.9 1.9 3.6-3.7"></path>
              </g>
              <g class="coperchio" data-coperchio>
                <rect x="3.6" y="6.9" width="16.8" height="3.7" rx="1.2"></rect>
              </g>
            </svg>
            <span class="scritte" data-scritte>
              <span class="scritta" data-scritta="riposo">Archive all</span>
              <span class="scritta scritta--fatto" data-scritta="fatto">Inbox zero</span>
            </span>
            <span class="conto" data-conto aria-hidden="true"><span class="conto__cifra" data-cifra>6</span></span>
          </span>
        </button>
        <span class="posto-annulla" data-posto-annulla>
          <button class="annulla" type="button" data-annulla tabindex="-1">
            <span class="annulla__scritta">Undo</span>
            <span class="annulla__tempo" aria-hidden="true"><span data-tempo></span></span>
          </button>
        </span>
      </div>
      <p class="voce" data-voce aria-live="polite"></p>
    </section>
    <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>

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.

21 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 “Archive all button” 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

In the middle of a white background a small stack of three unread emails, one in front of the others, with an initials avatar, the sender, the subject and the time; below, a white pill with a box drawn in line, the label Archive all and a grey round chip with the number 6. On hover the lid lifts a touch and the front email leans towards the button. The click squeezes the pill, which springs back; the lid opens and the front email lifts a hair and drops into the box, shrinking and turning slightly, while the others move forward and a new one appears from behind. Every email that goes in makes the box give and the number rolls down by one. When all six are in, the lid shuts with a bounce, the number chip narrows and disappears, the label becomes Inbox zero in blue on a pale blue pill and a tick is drawn on the box; above, where the stack was, «You’re all caught up». Beside it a black Undo pill slides out with a line shortening over four seconds: pressed, the emails climb back out of the box one at a time and the number returns to 6. Left to run out, Undo slides back in and shortly after new mail arrives from above.

How it works

The stack

The six emails are absolute rows in the same place; one function gives each its place in the stack (offset upwards, scale, opacity and layer) from its index, and the first three show. When the first one drops, the others get their new place with a back.out: they all move forward by themselves.

The fall into the box

The distance between the centre of the email and the centre of the box is measured with getBoundingClientRect at the moment the fall starts (GSAP function values), so it is right even after a resize or while the stack is moving. The email goes down with power2.in, scales to 0.07 and turns seven degrees, alternating.

The blow and the number

Every arrival squashes the bottom of the box around its lower edge with svgOrigin and brings it back with a bounce, and changes the number: the new digit comes in from above and the old one leaves at the bottom, in two separate elements, so they can overlap.

Undo and new mail

Undo grows from behind the button and its line shortens with a linear tween; when it ends, it slides back and a delayedCall brings the emails in from above. Pressed earlier, the emails come out of the box in reverse, the last archived first.

Values to change

NameFileDefaultWhat it changes
STEPscript.js0.16The seconds between one email dropping and the next.
FALLscript.js0.42How long one email takes to drop.
SPRINGscript.js1.6How much the lid, the stack and the label bounce.
PRESSscript.js0.96How much the button squeezes.
UNDO_TIMEscript.js4The seconds during which Undo can still be pressed.
REFILLscript.js1.2The seconds before new mail arrives.
ACCENTscript.js#2f5beaThe colour of the button at Inbox zero.

Try them in the Playground

When to use it

In mail, messaging, notification or task apps: clearing a list of things to read in one gesture, with the satisfaction of watching them go and the chance to go back for a few seconds without a confirmation dialog.

On phones

The stack, the button and Undo fit the width of the box; a finger presses like the mouse, without the lid lifting on hover.

With reduced motion

No falls, lid or bounces: the emails fade out together, the number goes to zero, the labels swap with a fade and Undo appears in place; the time line still shortens, because it is the information.

Pitfalls

  • The distance to the box must be worked out when the fall starts, not when the timeline is built: by then the stack has moved and the email is no longer where it was.
  • The two labels are absolute: the container has no width of its own, it must be measured and set by hand, also on resize.
  • An invisible Undo still reachable with Tab could still be pressed: when it slides back, tabIndex goes back to -1 and focus returns to the button.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 14 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