Skip to content
animorio
IT
All components

Cancel plan button

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

Under a subscription card, on very light grey, a quiet Cancel plan button: one gesture, press. The button grows in place into a small confirmation, with what you lose, Keep plan and Cancel anyway to hold while a red ring fills; once confirmed, it shrinks into the date the plan ends, with Resume 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>
<!--
  "Cancel plan 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 cancel plan button that asks first</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 plan card of a billing page with a quiet Cancel plan button: pressed, the button
         grows into a small confirmation in the same place (what you lose, Keep plan, and Cancel anyway that has to be
         held for a moment while a ring fills); confirmed, it shrinks into the date the plan ends, with Resume -->
    <section class="pezzo" data-pezzo aria-label="Your subscription">
      <article class="piano" data-piano>
        <span class="piano__icona" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M4 16.5c3.2-1 5.6-3.3 7.3-7.1.6-1.4 1.2-2.6 2.3-3.4"></path><path d="M13.6 6c1.9-.4 3.9.2 5.4 1.6"></path><path d="M4 19.5h16"></path></svg>
        </span>
        <span class="piano__testo">
          <span class="piano__nome">Skerry Pro</span>
          <span class="piano__dati">$24 / month · 3 seats</span>
        </span>
        <span class="stato" data-stato>
          <span class="stato__voce" data-voce="attivo">Renews Nov 28</span>
          <span class="stato__voce stato__voce--fine" data-voce="fine">Ends Nov 28</span>
        </span>
      </article>

      <div class="posto" data-posto>
        <div class="morph" data-morph>
          <!-- rest: the quiet button -->
          <button class="strato strato--tasto" type="button" data-strato="tasto" data-apri>
            <span>Cancel plan</span>
          </button>

          <!-- open: the confirmation in place -->
          <div class="strato strato--conferma" data-strato="conferma" role="group" aria-label="Confirm cancelling">
            <p class="conferma__titolo">Cancel Skerry Pro?</p>
            <ul class="perdi">
              <li class="perdi__riga" data-riga>
                <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="9" r="3.2"></circle><path d="M3.8 18.5c.7-2.8 2.7-4.4 5.2-4.4s4.5 1.6 5.2 4.4"></path><path d="M15.6 6.4a3 3 0 0 1 0 5.2M17.4 14.6c1.4.6 2.4 1.9 2.8 3.9"></path></svg>
                <span>2 teammates lose access</span>
              </li>
              <li class="perdi__riga" data-riga>
                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.8 7.2a1.6 1.6 0 0 1 1.6-1.6h3.9l1.9 2.1h7.4a1.6 1.6 0 0 1 1.6 1.6v7.9a1.6 1.6 0 0 1-1.6 1.6H5.4a1.6 1.6 0 0 1-1.6-1.6V7.2Z"></path><rect x="10" y="12.2" width="4.4" height="3.6" rx=".8"></rect><path d="M10.9 12.2v-.9a1.3 1.3 0 0 1 2.6 0v.9"></path></svg>
                <span>14 projects become read-only</span>
              </li>
            </ul>
            <div class="scelte">
              <button class="scelta scelta--tieni" type="button" data-tieni>Keep plan</button>
              <button class="scelta scelta--via" type="button" data-via aria-label="Hold to cancel anyway">
                <span class="anello" aria-hidden="true">
                  <svg viewBox="0 0 20 20"><circle class="anello__fondo" cx="10" cy="10" r="7.5"></circle><circle class="anello__pieno" data-anello cx="10" cy="10" r="7.5" pathLength="100"></circle><path class="anello__segno" data-segno d="M6.6 10.2l2.3 2.3 4.6-4.8" pathLength="100"></path></svg>
                </span>
                <span class="via__scritte"><span data-via-scritta="riposo">Cancel anyway</span><span data-via-scritta="tieni">Keep holding</span><span data-via-scritta="fatto">Cancelled</span></span>
              </button>
            </div>
            <p class="conferma__nota" data-nota>Hold to confirm</p>
          </div>

          <!-- done: the date it ends, and the way back -->
          <div class="strato strato--fine" data-strato="fine">
            <span class="fine__data">
              <svg data-cal viewBox="0 0 24 24" aria-hidden="true"><rect x="4" y="5.5" width="16" height="14.5" rx="2.5"></rect><path d="M4 10h16M8.5 3.5v3.5M15.5 3.5v3.5"></path></svg>
              <span>Plan ends on Nov 28</span>
            </span>
            <button class="riprendi" type="button" data-riprendi>Resume</button>
          </div>
        </div>
      </div>
    </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.

34 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 “Cancel plan 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 very light grey background, in the middle, the white card of a subscription: Skerry’s purple icon, Skerry Pro, $24 / month · 3 seats in grey and on the right a green Renews Nov 28 badge. Below it, a white pill with the grey words Cancel plan. A fake pointer arrives, the words turn red, the click squeezes it a touch and the pill grows in place into a card with a small bounce: Cancel Skerry Pro?, two lines with their line icons, 2 teammates lose access and 14 projects become read-only, and two buttons, a black Keep plan and a soft red Cancel anyway with a thin ring; below, Hold to confirm. The pointer passes over Keep plan, then presses Cancel anyway and lets go too soon: the ring had filled halfway and runs back, the button widens again on a spring and Hold a little longer appears underneath. The second time it holds: the label becomes Keep holding, the red ring closes, a check mark draws itself inside and the button gives a small kick. The card shrinks into a pill with a calendar and Plan ends on Nov 28 next to Resume, the card’s badge turns amber, Ends Nov 28, and the icon fades to grey. The pointer presses Resume: everything goes back as it was, with the badge green again.

How it works

One surface

The button, the confirmation and the final pill are three layers inside the same white surface. On every change the incoming layer is measured and GSAP takes the surface’s width, height and radius to its size with back.out: it is always the same piece changing shape, not a dialog opening.

The reserved place

The container under the card keeps the height of the open confirmation, measured at start and on every resize: when the button grows, the plan card above does not move by a pixel.

The ring is a number

Holding takes a number from 0 to 1 over HOLD seconds, with no curve, and the ring is an SVG circle with pathLength 100 whose stroke-dashoffset goes from 100 to 0. Let go early and another tween takes it back to 0 with power3.out from wherever it had got to.

Clear states

Each step changes the rest too: Cancel anyway becomes Keep holding, the note underneath changes, the card’s badge goes from Renews to Ends and the icon fades. Resume brings everything back with the same timings.

Finger and keyboard

Cancel anyway uses pointerdown and pointerup with pointer capture and touch-action none, so a sliding finger does not leave the press half done; holding Space or Enter works the same. Inactive layers are inert, and at the first touch the autopilot stops.

Values to change

NameFileDefaultWhat it changes
HOLDscript.js1.1The seconds to hold Cancel anyway to cancel.
SPRINGscript.js1.25How much the button bounces as it grows and shrinks (1 = none).
MORPH_TIMEscript.js0.5The seconds of the button turning into the confirmation and back.
REDscript.js#e5484dThe red of the filling ring.
PLANscript.jsSkerry ProThe plan’s name.
END_DATEscript.jsNov 28The day the plan ends.

Try them in the Playground

When to use it

On the billing or settings page of an app or a SaaS: cancelling a subscription, a plan, an add-on, leaving a team, without opening a dialog over the page and saying first what you lose.

On phones

The same card and the same button, at the box’s width: the confirmation narrows to 32 pixels less than the screen, a finger holds like the mouse and the page does not scroll while holding.

With reduced motion

No bounces or movement: the surface changes size at once, layers and labels change with a fade and the ring still fills, because it is the information.

Pitfalls

  • The layers must be absolute, otherwise the surface takes the size of all three together and the incoming one cannot be measured.
  • Without the reserved place the plan card would jump up and down at every opening: in a real interface it is the thing you notice most.
  • Without pointer capture, on the phone a finger sliding off the button never sends pointerup and the ring would carry on by itself.
  • Hidden layers must be inert: a transparent button under the finger or under Tab would still be pressed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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