Skip to content
animorio
IT
All components

Envelope archive button

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

The Archive button of a mail app, alone on white: one gesture, press. The lid of the drawn box lifts, an envelope drops in, the lid snaps shut with a bounce and the label becomes Archived, in blue; next to it Undo slides out, with a thin line counting down the seconds to go back.

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>
<!--
  "Envelope archive 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 button with the envelope dropping 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. The Archive button of a mail app: pressed, the lid of the box lifts, an envelope drops in,
         the lid shuts and the button says Archived; next to it Undo slides out with a thin line counting down -->
    <section class="pezzo" data-pezzo aria-label="Archive this conversation">
      <div class="fila" data-fila>
        <button class="tasto" type="button" data-tasto aria-live="polite">
          <span class="tasto__corpo" data-corpo>
            <svg class="scatola" data-scatola viewBox="0 0 24 24" aria-hidden="true">
              <g class="busta" data-busta>
                <rect x="7.4" y="2.6" width="9.2" height="6.6" rx="1.1"></rect>
                <path d="M7.9 3.3 12 6.3l4.1-3"></path>
              </g>
              <g class="fondo" data-fondo>
                <path class="fondo__pieno" d="M4.6 10.4h14.8v8.1a2 2 0 0 1-2 2H6.6a2 2 0 0 1-2-2Z"></path>
                <path class="fondo__maniglia" d="M10 14.2h4"></path>
              </g>
              <g class="coperchio" data-coperchio>
                <rect x="3.4" y="7" width="17.2" height="3.4" rx="1.1"></rect>
              </g>
            </svg>
            <span class="scritte" data-scritte>
              <span class="scritta" data-scritta="riposo">Archive</span>
              <span class="scritta scritta--fatto" data-scritta="fatto">Archived</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="nota" data-nota aria-hidden="true">Re: Studio visit on Thursday</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.

15 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 “Envelope archive 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

On a white background, in the middle, a white pill with a thin border: a box drawn in line and the word Archive. Below it, in grey, the subject of the email, Re: Studio visit on Thursday. A fake pointer arrives and the box’s lid lifts a touch; the click squeezes the button, which springs back up. The lid opens, a small envelope appears from above and drops into the box, the lid snaps shut with a bounce and the bottom of the box squashes slightly under the blow. Meanwhile Archive leaves upwards, the button narrows or widens to the new word and Archived comes in from below; the pill turns pale blue with a blue border and label, and the email subject dims. Next to it, from behind the button, a black Undo pill slides out with a white line underneath that shortens over five seconds. The pointer presses Undo: the envelope rises out of the box and disappears, and the label goes back to Archive from above. The second time the pointer moves away: the line runs out, Undo slides back behind the button and Archived stays; another click on the button takes it out of the archive.

How it works

The box in three pieces

The icon is an SVG with three groups in this order: the envelope, the bottom of the box and the lid. The bottom and the lid are filled with the button’s colour, so the falling envelope disappears behind the bottom without masks, and the lid turns on its hinge with svgOrigin.

One label at a time

Archive and Archived sit on top of each other in a window one line high. The old one leaves in 0.2 seconds, the window’s width goes to the size of the new one and the new one comes in 0.17 seconds later with a small back.out: the two labels are never readable together.

Undo growing from behind

Undo lives in a container zero wide with hidden overflow. GSAP takes the container’s width to Undo’s size: the row stays centred and the button moves aside by itself, without jumps.

Time is a line

The line under Undo is a span whose scaleX goes from 1 to 0 in UNDO_TIME seconds, with no curve. When it ends, Undo slides back and leaves the Tab order; pressing Archived again takes the email out of the archive.

The autopilot stops

A fake pointer runs the loop by itself for the preview: archive and undo, archive again and let the countdown run out, then unarchive. At the first real touch, click or key the autopilot stops and the button is yours.

Values to change

NameFileDefaultWhat it changes
UNDO_TIMEscript.js5The seconds during which Undo can still be pressed.
SPRINGscript.js1.6How much the lid and the label bounce.
PRESSscript.js0.96How much the button squeezes when you press it.
ACCENTscript.js#2f5beaThe colour of the archived button.
LABELscript.jsArchiveThe button’s label.
DONE_LABELscript.jsArchivedThe label after the click.
SUBJECTscript.jsRe: Studio visit on ThursdayThe email subject under the button.

Try them in the Playground

When to use it

In mail, messaging, task or document apps: archiving a conversation, a task, a project, where the action is quick and you must be able to go back for a few seconds without a confirmation dialog.

On phones

The same button and the same Undo, both fitting the box’s width; a finger presses like the mouse, without the lid lifting on hover.

With reduced motion

No lid, envelope or bounces: the button changes colour, the labels swap with a fade one after the other and Undo appears in place; the time line still shortens, because it is the information.

Pitfalls

  • If the box’s bottom is not filled, the falling envelope shows through: the fill must have the button’s colour even when it turns pale blue.
  • The two labels are absolute: the window has no width of its own, so it must be measured and set by hand, on resize too.
  • An invisible Undo still reachable with Tab would still be pressed: when it slides back, tabIndex goes back to -1 and focus moves to the button.
  • Press and scale go on the button, colours and shadow on its child: GSAP’s transform would wipe the CSS one.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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