Skip to content
animorio
IT
All components

Book a demo button

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

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.

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>
<!--
  "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>

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.

19 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 “Book a demo 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 there is a black pill with a small drawn calendar and the words «Book a demo». On hover it grows a little and the calendar tilts; pressed, it squashes and its shadow tightens. On click the label fades and the pill opens on a short spring into a white card about 340 pixels wide, with a thin border and a shadow that spreads as it grows: at the top «Pick a time» and «30 min · Video call with the Tidelane team», below three tabs for Tue 28, Wed 29 and Thu 30 on a grey ground, with a white pill as the indicator, then the day’s free slots as thin pills, and at the bottom the time zone in grey with a small globe. Changing day, the indicator slides under the new tab with a small bounce, the day number gives a one pixel nod, the old slots rise and fade and the new ones come in staggered from below. Picking a slot, its pill squashes, fills with black from the centre and its text turns white; the other slots leave, the card fades and closes back into a black pill that reads «Booked · Wed 10:30», with the green check drawing itself; the pill sinks one pixel and comes back, and «Invite sent to ada@ferrow.io» appears underneath. After a few seconds «Book a demo» is back. The drawn pointer does it all by itself; the cross, the Esc key or a click outside close the card.

How it works

One shell that changes shape

Button 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.

Sizes taken with the font loaded

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 and the slots

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.

From the choice to the done pill

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».

The autopilot

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.

Values to change

NameFileDefaultWhat it changes
SPRINGscript.js0.55How long the spring that opens the pill into the card and closes it lasts, in seconds.
STAGGERscript.js0.045The delay between one slot and the next as they come in.
HOLDscript.js2.6How many seconds the «Booked» pill stays before going back to «Book a demo».
INKscript.js#0a0a0aThe colour of the pill and of the chosen slot.
CHECK_COLORscript.js#4ade80The colour of the check drawn once booked.
CARD_WIDTHscript.js340How wide the open card is, in pixels.
TIMEZONEscript.jsCentral European Time (GMT+1)The time zone written at the bottom of the card.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The black is not the shell’s background colour but a layer on top: animating background-color from black to white goes through grey and muddies the border.
  • A day’s slots are shown only after hiding the others: two fromTo tweens on the same elements, one on opening and one on changing day, steal each other’s values without overwrite.
  • The card is measured with the panel already as wide as it will be: measured before, at a free width, lines wrapped at another point and the height came out wrong.

Libraries

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.

Testing

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