
The elastic button
Buttons, Hover, Text
A black «Book a demo» button in the style of product interface pieces, on white: on click the pill opens on a short spring into a small card with three days and the free time slots. The day indicator slides under the choice, the slots come in staggered, and picking one fills its pill, the others leave and the card closes back into the button, which now reads «Booked · Wed 10:30» with a drawn check.
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>
<!--
"Book a demo 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 Book a demo button that opens into time slots</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 black pill that opens into a small booking card: three days, the free time slots, the time zone;
picking a slot closes the card back into the pill, which now says when the demo is -->
<div class="booker" data-booker>
<div class="shell" data-shell>
<span class="shell__ink" data-ink aria-hidden="true"></span>
<span class="shell__edge" data-edge aria-hidden="true"></span>
<button class="face face--idle" type="button" data-open data-autoclic aria-expanded="false" aria-controls="panel">
<svg class="cal" data-cal viewBox="0 0 24 24" aria-hidden="true">
<rect x="4" y="5.5" width="16" height="14.5" rx="3"></rect>
<path d="M4 10h16"></path>
<path class="cal__ring" d="M8.5 3.5v4M15.5 3.5v4"></path>
<path class="cal__tick" d="M9 14.5h2.2"></path>
</svg>
<span class="face__label">Book a demo</span>
</button>
<div class="panel" id="panel" data-panel aria-hidden="true">
<div class="panel__head">
<div>
<p class="panel__title">Pick a time</p>
<p class="panel__sub">30 min · Video call with the Tidelane team</p>
</div>
<button class="panel__close" type="button" data-close aria-label="Close">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17"></path></svg>
</button>
</div>
<div class="days" role="tablist" data-days>
<span class="days__pill" data-indicator aria-hidden="true"></span>
</div>
<div class="slots" data-slots></div>
<p class="tz">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"></circle><path d="M4 12h16M12 4c2.4 2.3 2.4 13.7 0 16M12 4c-2.4 2.3-2.4 13.7 0 16"></path></svg>
<span data-tz></span>
</p>
</div>
<div class="face face--done" data-done aria-live="polite">
<svg class="tick" viewBox="0 0 24 24" aria-hidden="true"><path data-check d="m5.5 12.5 4.2 4.2 8.8-9.4"></path></svg>
<span data-booked>Booked</span>
</div>
</div>
<p class="note" data-note>Invite sent to <span>ada@ferrow.io</span></p>
</div>
<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>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.
19 values to change
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 “Book a demo button” from Animorio and fit it into my siteButton and card are the same element: a shell with hidden overflow whose width, height and corners GSAP takes from the pill’s size to the card’s, with back.out for the spring. Underneath there is a black layer that fades as it opens and a thin border that fades in: the black turns white without animating a background colour.
The pill’s width is computed from the text and the icon after document.fonts.ready, the card’s from the panel itself, laid out 340 pixels wide (or less, on a phone) and measured with offsetHeight. On resize everything is measured again and the shell takes the right size for its state.
The indicator is a white pill in absolute position: GSAP gives it the x and the width of the chosen tab, read with offsetLeft and offsetWidth. Each day has its own group of slots stacked on the others: the old one rises and fades, the new one comes in with fromTo and a 45 millisecond stagger.
A single timeline: the slot squashes and fills from the centre, the others leave, the panel fades, the shell goes back to a pill as wide as «Booked · Wed 10:30», the check draws itself with strokeDashoffset, the pill sinks one pixel and comes back up with back.out. A delayedCall brings back «Book a demo».
An async function awaits GSAP tweens (they can be awaited like promises) and takes the drawn pointer to the button, to Wed and to 10:30, reading the real position each time. At the first real touch a token changes and the run stops; it starts again after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
SPRING | script.js | 0.55 | How long the spring that opens the pill into the card and closes it lasts, in seconds. |
STAGGER | script.js | 0.045 | The delay between one slot and the next as they come in. |
HOLD | script.js | 2.6 | How many seconds the «Booked» pill stays before going back to «Book a demo». |
INK | script.js | #0a0a0a | The colour of the pill and of the chosen slot. |
CHECK_COLOR | script.js | #4ade80 | The colour of the check drawn once booked. |
CARD_WIDTH | script.js | 340 | How wide the open card is, in pixels. |
TIMEZONE | script.js | Central European Time (GMT+1) | The time zone written at the bottom of the card. |
For the «Book a demo» button on the landing page of a software product, a business service or a studio that books calls: whoever presses it picks a time without leaving the page, and the button itself remembers the appointment.
The card takes at most the width of the box minus the margins and measures its own height; the slots stay three per row, 35 pixels tall, and a tap does what a click does.
The pill neither stretches nor bounces: it becomes a card and a pill again at once, the parts appear with a fade, the indicator jumps into place, the check is already drawn and the drawn pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.2 KB; the libraries: GSAP 28 KB.
Tested on 26 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.