Skip to content
animorio
IT
All components

Eject button

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

The Eject button of an external drive, with the drive plugged into its port on the right edge. On tap the triangle hops, an orange ring fills around the icon while the last writes finish and a light runs along the drive’s bar; then the icon turns into a green tick, the button kicks and the drive springs out of the port: “Safe to remove”. One more tap plugs it back in.

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>
<!--
  "Eject 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>Eject button</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">
    <!-- the Eject button of an external drive: it lets the last writes finish with a ring around the icon,
         then pushes the drive out of its port and says it is safe to remove. One more tap plugs it back in -->
    <div class="ej" data-ej>
      <button class="ej__btn" type="button" data-btn data-state="idle" aria-label="Eject Atlas SSD">
        <span class="ej__ico" aria-hidden="true">
          <svg class="ej__ring" viewBox="0 0 48 48"><circle data-ring cx="24" cy="24" r="22.5" pathLength="1"></circle></svg>
          <svg class="ej__glyph" data-glyph viewBox="0 0 24 24"><path data-tri d="M12 5.800 18.200 13.400H5.800Z"></path><rect x="5.800" y="16.100" width="12.400" height="2.500" rx="1.250"></rect></svg>
          <svg class="ej__check" viewBox="0 0 24 24"><path data-check d="M6.500 12.600l3.700 3.700 7.300-8" pathLength="1"></path></svg>
        </span>
        <span class="ej__text">
          <span class="ej__label"><span data-label>Eject Atlas SSD</span></span>
          <span class="ej__sub" data-outsub>1.2 TB free of 2 TB</span>
        </span>
      </button>
      <span class="ej__drive" data-drive aria-hidden="true">
        <span class="ej__plug"></span>
        <span class="ej__body">
          <b>ATLAS</b>
          <i data-bar></i>
        </span>
      </span>
    </div>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

14 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Eject 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 white, a light grey pill: on the left a white circle with the eject symbol (the triangle over the short bar), then “Eject Atlas SSD” with the free space below. On the right edge sits the port, and plugged into it a small graphite drive with its metal plug, its name and the bar that says how full it is. Tap the button and the pill tightens and bounces, the triangle hops, the label rolls to “Finishing writes”, an orange ring fills around the circle and a light runs along the drive’s bar, while the files left go from two to one. Once the writes are over the circle turns green, the symbol closes and a tick draws in its place, the button kicks back and the drive springs out of the port, turning slightly and showing its plug: “Safe to remove”. One more tap and the drive goes back in, button and drive shake once and everything is as before.

How it works

Three states

Connected, writing, ejected: the state is written in an attribute of the button, from which CSS takes the colours. While writing, taps do nothing and the button carries aria-busy.

The ring of the writes

A circle with pathLength 1 around the icon: GSAP takes its stroke-dashoffset from 1 to 0 over the WRITE time. Halfway the line below goes from two files to one; at the end the ejection starts.

The drive leaving

The drive sits behind the button, its plug hidden under the edge. To eject it GSAP moves it by PUSH pixels on an elastic spring and turns it three degrees; the button recoils slightly the other way.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#1f9d61The colour of the button when the drive is safe to remove.
WRITEscript.js1.8How many seconds the last writes take before ejecting.
PUSHscript.js26How many pixels the drive comes out of its port.

Try them in the Playground

When to use it

In the devices panel of a backup app, a file manager or a NAS, next to each connected drive; and wherever an action first has to wait for something to finish: disconnecting a device, closing a session, shutting a server down.

On phones

The same button, 64 pixels tall: with the drive it is about 290 pixels wide and fits a 320 screen too. The whole pill is tappable; the drive is only to look at.

With reduced motion

No hops or springs: on tap labels and colours change, the ring shows half full and, once the wait is over, the icon is already the tick and the drive already out of the port. The light on the drive’s bar stays still. The demo’s pointer does not start.

Pitfalls

  • While the writes finish the button must not be disabled (it would lose focus): it ignores taps and says aria-busy; the outcome lands in an aria-live region.
  • With a pathLength 1 path GSAP rounds stroke-dashoffset to whole pixels: autoRound is switched off at the top of the script, otherwise ring and tick appear all at once.
  • The drive is a sibling of the button, behind it: inside the button it would get clipped or widen the tappable area.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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