Skip to content
animorio
IT
All components

Copy email button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.6 KBGSAP 28 KBFreeDownload the zip

The Copy my email button of the portfolio of a made-up design studio, Ondine: a dark pill with an envelope in a round well, the label and the address under it. On the click the address gets selected, a paper copy of it peels off the pill with its shadow, flies over the envelope folding narrow and drops in, behind the pocket; the flap closes, an apricot seal stamps on its tip, the two-sheet icon becomes a tick and the label rolls to Copied. The address really goes on the clipboard.

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>
<!--
  "Copy email 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 Copy email button with the address that peels off and folds into the envelope</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the Copy email button of a made-up design studio, Ondine: on the click the address is selected, a paper copy of
         it peels off the pill, folds and drops into the envelope, the flap closes on a seal and the label rolls to
         Copied. The address really goes on the clipboard. -->
    <div class="wrap" data-wrap>
      <div class="pill" data-pill>
        <span class="skin" aria-hidden="true">
          <span class="skin__light" data-light></span>
          <span class="skin__sweep" data-sweep></span>
        </span>

        <button class="btn" type="button" data-copy data-autoclic aria-label="Copy the email address hello@ondine.studio">
          <span class="well" aria-hidden="true">
            <span class="well__disc" data-disc></span>
            <!-- the back of the envelope and its flap, behind the paper slip -->
            <svg class="env env--back" data-env viewBox="0 0 28 28">
              <path class="env__body" d="M5 10.2h18v10.6a1.8 1.8 0 0 1-1.8 1.8H6.8A1.8 1.8 0 0 1 5 20.8Z"></path>
              <path class="env__flap env__flap--up" data-flapup d="M5.4 10.2 14 3.8l8.6 6.4Z"></path>
            </svg>
            <!-- the front pocket and the closed flap, in front of the slip -->
            <svg class="env env--front" data-env viewBox="0 0 28 28">
              <path class="env__pocket" d="M5 13.2 14 19.2l9-6v7.6a1.8 1.8 0 0 1-1.8 1.8H6.8A1.8 1.8 0 0 1 5 20.8Z"></path>
              <path class="env__seam" d="M5.7 22 11.8 17.4M22.3 22 16.2 17.4"></path>
              <path class="env__flap env__flap--down" data-flapdown d="M5.4 10.2 14 16.6l8.6-6.4Z"></path>
            </svg>
            <svg class="seal" data-seal viewBox="0 0 28 28">
              <rect x="10.6" y="13" width="6.8" height="6.8" rx="2.2" transform="rotate(45 14 16.4)"></rect>
              <path d="M12.3 16.5 13.5 17.7 15.8 15.2"></path>
            </svg>
          </span>

          <span class="txt">
            <span class="txt__win"><span class="txt__now" data-label>Copy my email</span></span>
            <span class="txt__win txt__win--sub">
              <span class="txt__sel" data-sel></span>
              <span class="txt__now" data-addr>hello@ondine.studio</span>
            </span>
          </span>

          <span class="copyicon" aria-hidden="true">
            <svg viewBox="0 0 20 20">
              <rect class="copyicon__back" data-sq1 x="3.2" y="3.2" width="9.6" height="9.6" rx="2.4"></rect>
              <rect class="copyicon__front" data-sq2 x="7.2" y="7.2" width="9.6" height="9.6" rx="2.4"></rect>
              <path class="copyicon__tick" data-tick d="M5 10.4 8.4 13.6 15.2 6.6"></path>
            </svg>
          </span>
        </button>

        <!-- the paper copy of the address that peels off and goes into the envelope -->
        <span class="slip" data-slip aria-hidden="true">
          <span class="slip__mark">@</span><span class="slip__text" data-sliptext>hello@ondine.studio</span>
        </span>
      </div>
      <span class="sr" aria-live="polite" data-live></span>
    </div>
  </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.

23 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 “Copy email 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 ground there is a single dark pill, lighter at the top, with a hairline edge that catches the light: on the left a round well with an envelope drawn in line, in the middle the label Copy my email and under it, in a monospaced face, the address hello@ondine.studio, on the right the icon of two overlapping sheets. On hover the pill rises a pixel, a warm light follows the pointer, the envelope’s flap lifts slightly and the two sheets part by a hair; pressed, it squashes. On the click the address gets selected with an apricot fill running in from the left, and a copy of it on a white paper slip, with the @ sign in a small apricot square, peels off the pill and rises with its shadow, slightly tilted; the original stays where it is. The envelope opens: the closed flap folds away and the open one rises behind. The slip flies over the well, folds narrow and drops into the envelope, behind the front pocket; the envelope bumps, the flap closes, its lines warm up and an apricot seal with a tick stamps on its tip. Meanwhile the two sheets of the icon close into an apricot tick, the label rolls to Copied, the line under it to Paste it in any mail app, and a light crosses the pill, which swells a hair. Two seconds later everything rolls back and the pill is ready again.

How it works

The slip between the back and the front of the envelope

The envelope is two stacked SVGs in the well: behind, the body and the open flap; in front, the filled pocket and the closed flap. The slip is a sibling with the z-index in between. For it to really pass behind the pocket, neither the well nor the button has a transform or an opacity: they would make their own stacking context and the slip would sit always above or always below. The envelope’s bump moves the two SVGs together.

The copy laid on the original

At every click the slip goes back to no transform, is measured, and is laid with x and y in pixels so that its text sits exactly over the address in the pill: as it peels off it looks like the same writing lifting, while the original stays. Sizes are read again at every click, so they hold at any width.

The flap that opens and closes

Two flaps instead of one that turns: the closed one, in front, squashes with scaleY from its top edge; the open one, behind, grows from the edge upwards with a back.out. So the open flap sits behind the slip and the closed one in front, without changing z-index mid-animation.

The rolling lines

Label and address each sit in a one-line window: the new text comes in from below on a spring, the old one leaves at the top and at the end takes the new text, so the data attributes stay on the same element and lines never pile up.

The real clipboard

Only a real click (event.isTrusted) calls navigator.clipboard.writeText, inside a try and with the promise’s catch: the autopilot makes the gesture without asking for clipboard permission, and where there is no clipboard the gesture runs anyway.

Values to change

NameFileDefaultWhat it changes
EMAILscript.jshello@ondine.studioThe address that really gets copied.
LABELscript.jsCopy my emailThe label of the button at rest.
DONEscript.jsCopiedThe label once the address is on the clipboard.
HINTscript.jsPaste it in any mail appThe line under it once it has copied.
LIFTscript.js1How high the slip lifts before flying into the envelope.
SPRINGscript.js1How much the envelope and the pill bounce.
HOLDscript.js2.2The seconds Copied stays before going back to rest.
IDLEscript.js1.1The seconds before the autopilot starts.
--accentostyle.css#ff7a4dThe colour of the selection, the seal and the tick.

Try them in the Playground

When to use it

On the contact page or in the footer of the portfolio of a designer, a photographer, an illustrator, an architect or a studio: visitors copy the address in one click instead of opening a mail app they may not use, and the gesture says it worked.

On phones

The pill takes almost the whole width and sizes shrink with the type; the finger taps like the mouse and the slip makes the same flight. Without hover the light stays off and the flap still.

With reduced motion

No flight or springs: the selection appears and fades, the envelope stays closed and the seal fades in, the icon becomes the tick already drawn and the lines change with a fade. The address still gets copied.

Pitfalls

  • The slip has to pass behind the envelope’s pocket: a single transform on the well (to make it bump) turns it into a separate stacking context, with the slip always in front. The bump goes on the two SVGs, never on their container.
  • The slip must be put back to no transform before measuring it: getBoundingClientRect also counts the scale of the previous round, and the copy no longer landed on the address.
  • The autopilot must not touch the clipboard: without a real gesture the browser refuses and logs an error. Only a click with event.isTrusted copies.
  • The rolling lines put the new text on the old element once it has left, otherwise the data attributes stay on the removed element and the next round can’t find the label.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

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

Testing

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