Skip to content
animorio
IT
All components

Back in stock button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

The small card of a shoe from an invented shop, Arlo Runners, with a real photo of the white sneaker and sizes 39 to 45: 42 is sold out and struck through by a thin line. Tapping it, ‘Add to bag’ springs into an orange ‘Notify me when it’s back’ button; pressed, it opens into an email field typed letter by letter, then closes back into ‘You’re on the list’ with a check that draws itself and a swinging bell, while 42 takes a thin ring labelled ‘Watching’.

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>
<!--
  "Back in stock 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 Notify me when it’s back button with the size that lights up</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" data-stage>
    <!-- a small product card of an invented running shoe shop. Size 42 is sold out: picking it turns Add to bag into
         Notify me when it's back; pressed, the button opens into an email field, then closes into You're on the list
         and size 42 keeps a thin ring that says Watching -->
    <article class="shoe" data-wrap aria-label="Arlo Runners, Glow Low sneaker">
      <figure class="shoe__pic">
        <img class="shoe__img" data-img src="scarpa.webp" width="770" height="430" alt="A white low top sneaker with a glowing sole on a light background">
        <span class="shoe__shine" aria-hidden="true"></span>
      </figure>

      <div class="shoe__info">
        <div class="shoe__row">
          <p class="shoe__brand">Arlo Runners</p>
          <p class="shoe__price">$148</p>
        </div>
        <p class="shoe__name">Glow Low <span class="shoe__colour">Chalk white</span></p>
      </div>

      <div class="sizes">
        <div class="sizes__head">
          <span class="sizes__label">Size <span class="sizes__unit">EU</span></span>
          <span class="sizes__read" data-read aria-live="polite"><span>41 in stock</span></span>
        </div>
        <div class="sizes__grid" data-grid role="radiogroup" aria-label="Size">
          <span class="sizes__sel" data-sel aria-hidden="true"></span>
          <span class="sizes__watch" data-watch aria-hidden="true"><span class="sizes__ring"></span><span class="sizes__tag">Watching</span></span>
          <button class="size" type="button" role="radio" aria-checked="false" data-size="39">39</button>
          <button class="size" type="button" role="radio" aria-checked="false" data-size="40">40</button>
          <button class="size" type="button" role="radio" aria-checked="true" data-size="41">41</button>
          <button class="size is-out" type="button" role="radio" aria-checked="false" data-size="42" aria-label="42, sold out">
            <span class="size__n">42</span>
            <svg class="size__strike" viewBox="0 0 10 10" preserveAspectRatio="none" aria-hidden="true"><line x1="0.6" y1="9.4" x2="9.4" y2="0.6"/></svg>
          </button>
          <button class="size" type="button" role="radio" aria-checked="false" data-size="43">43</button>
          <button class="size" type="button" role="radio" aria-checked="false" data-size="44">44</button>
          <button class="size" type="button" role="radio" aria-checked="false" data-size="45">45</button>
        </div>
      </div>

      <div class="cta is-add" data-cta>
        <span class="cta__body" data-body aria-hidden="true"><span class="cta__skin"></span></span>

        <button class="cta__btn" type="button" data-btn>
          <span class="cta__words" data-words>
            <span class="cta__word" data-word="add">
              <svg class="ic" viewBox="0 0 20 20" aria-hidden="true"><path d="M4.6 7.2h10.8l-.8 9.1a1.4 1.4 0 0 1-1.4 1.3H6.8a1.4 1.4 0 0 1-1.4-1.3Z"/><path d="M7.4 8.6V6.1a2.6 2.6 0 0 1 5.2 0v2.5"/></svg>
              <span class="cta__text">Add to bag</span>
            </span>
            <span class="cta__word" data-word="notify">
              <svg class="ic" viewBox="0 0 20 20" aria-hidden="true"><g data-bell-a><path d="M5.6 13.6V9.4a4.4 4.4 0 0 1 8.8 0v4.2l1.3 1.5H4.3Z"/><path d="M8.5 16.9a1.6 1.6 0 0 0 3 0"/></g></svg>
              <span class="cta__text">Notify me when it’s back</span>
            </span>
            <span class="cta__word" data-word="done">
              <svg class="ic ic--check" viewBox="0 0 20 20" aria-hidden="true"><path data-check pathLength="1" d="M5.2 10.4l3.2 3.2 6.6-7"/></svg>
              <span class="cta__text">You’re on the list</span>
              <svg class="ic ic--bell" viewBox="0 0 20 20" aria-hidden="true"><g data-bell-b><path d="M5.6 13.6V9.4a4.4 4.4 0 0 1 8.8 0v4.2l1.3 1.5H4.3Z"/><path data-clapper d="M8.5 16.9a1.6 1.6 0 0 0 3 0"/></g></svg>
            </span>
          </span>
        </button>

        <form class="cta__field" data-field novalidate>
          <svg class="cta__mail" viewBox="0 0 20 20" aria-hidden="true"><rect x="3.2" y="5" width="13.6" height="10" rx="2"/><path d="M3.8 6.2l6.2 4.6 6.2-4.6"/></svg>
          <span class="cta__input-wrap">
            <input class="cta__input" data-input type="email" inputmode="email" autocomplete="email" placeholder="Your email" aria-label="Email for the restock alert" tabindex="-1">
            <span class="cta__mirror" data-mirror aria-hidden="true"></span>
            <span class="cta__caret" data-caret aria-hidden="true"></span>
          </span>
          <button class="cta__send" type="submit" data-send aria-label="Notify me" tabindex="-1">
            <span class="cta__send-face" data-send-face>
              <svg class="cta__arrow" data-arrow viewBox="0 0 20 20" aria-hidden="true"><path d="M4.5 10h10.4M10.6 5.6 15 10l-4.4 4.4"/></svg>
              <svg class="cta__spin" data-spin viewBox="0 0 20 20" aria-hidden="true"><path d="M10 4a6 6 0 0 1 6 6"/></svg>
            </span>
          </button>
        </form>
      </div>
    </article>

    <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"/></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.

33 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 “Back in stock 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 card with rounded corners and a soft layered shadow rises slowly. At the top the real photo of a white sneaker with a glowing sole, on a warm grey ground; underneath the invented brand Arlo Runners, the name Glow Low Chalk white and the price, $148. Then the row of European sizes, 39 to 45, in small cells with a one pixel border: 41 is chosen, inside a black frame, and 42 is sold out, lighter, struck through diagonally by a thin line. At the bottom the black ‘Add to bag’ button with its bag. A drawn arrow taps 42: the cell gives under the finger, the black frame slides onto it stretching and settles on a spring, over the row it reads ‘42 sold out’ and the button squashes and bounces as it turns orange, with ‘Notify me when it’s back’ rising and a little bell swinging. On a tap the button opens into a white email field with a faint orange ring: the envelope, a blinking caret and the small orange square with the arrow come in, and the address types itself letter by letter. On send the arrow leaves to the right and a thin arc spins for a moment; then the field closes back into a very light peach button, ‘You’re on the list’, with the orange check drawing itself and the bell swinging and dying down, its clapper moving on its own. Meanwhile a thin orange ring lights up around 42, arriving a little wide and tightening, ‘Watching’ appears under it and over the row it reads ‘Watching 42’. Then the arrow goes back to 41: the button becomes ‘Add to bag’ again, the ring goes out and the loop starts over.

How it works

A button in two layers

The button is a body (.cta__body) that GSAP squashes and stretches on springs, and inside it a skin (.cta__skin) that takes the colour, border and shadows of each state from the is-add, is-notify, is-field and is-done classes through a CSS transition. So GSAP's transform never wipes out the CSS one, and the colours stay in the stylesheet.

The labels in the same cell

The three labels (with their icons) sit in the same grid cell, one over the other: the width is that of the longest and each stays centred. On a state change the old one leaves upwards with a 3 px blur and the new one rises from below with back.out(2).

One frame for the sizes

The frame of the chosen size is a single element that moves to the new cell by reading offsetLeft and offsetWidth: first it stretches towards the target in 0.16 s, then it settles with elastic.out. The positions are read again on resize, even mid loop, like the Watching ring.

The field that types itself

The email field is a real input: the pilot changes its value letter by letter with a tween on a number. The drawn caret sits after the last letter by measuring the text in an invisible mirror span with the same face; when a person taps the field it goes out and leaves the real caret.

Check, bell and ring

The check has pathLength 1 and draws itself by taking stroke-dashoffset from 1 to 0. The bell swings on damped keyframes (20, -16, 11, -7, 4 degrees) around its hook, and the clapper moves a little later, the other way. The ring on 42 comes in from scale 1.35 with elastic.out and the Watching label drops by 5 px.

Values to change

NameFileDefaultWhat it changes
SOLD_OUTscript.js42The sold out size, between 39 and 45: it is struck through and choosing it turns the button into Notify me.
START_SIZEscript.js41The size chosen at the start, between 39 and 45.
EMAILscript.jsmaya.okafor@hey.comThe email the autopilot types into the field.
ACCENTscript.js#f0531cThe one accent colour: the Notify me button, the Watching ring, the check.
TYPEscript.js0.055The seconds per letter of the email typed by the pilot.
WOBBLEscript.js1How much the button squashes and bounces when it changes state: 0 = none, 2 = double.
PAUSEscript.js1.1The seconds the autopilot waits between one gesture and the next.
LOOPscript.jstrueRepeats the autopilot's loop.

Try them in the Playground

When to use it

For the product page of a shoe shop, a clothing store or anything with sizes or variants: when a size runs out, instead of a dead button it collects the email of whoever wants it, without leaving the card.

On phones

The same animation with adapted sizes: the card is almost as wide as the screen, the photo and the size cells get shorter with the height, the button drops to 50 px on short screens; a finger picks the size, opens the field and gets the email keyboard.

With reduced motion

Nothing moves: the size frame, the button's labels, the field, the check and the Watching ring change with a fade, the email appears whole and the drawn arrow is not there.

Pitfalls

  • With the three labels stacked in a grid the icon stayed far from the short label: icon and text sit in the same piece, so each state centres itself.
  • An input's real caret blinks only when it has focus, and focusing it during the walk would scroll the page: the pilot's caret is drawn and measured with a mirror span; when a person taps the field it goes out.
  • The photo has a pure white ground and vanished on the white card: with mix-blend-mode multiply it takes the warm grey of its frame, like a studio shot.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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