Skip to content
animorio
IT
All components

Book button with seats

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

The button to book a seat at a workshop, on white, in the style of real product interface pieces: beside it the count of seats left, with a rolling digit and a thin bar getting shorter. Pressed, the button fills with orange while an arc spins and becomes You’re in with a check drawing itself; when the last seat goes, the black pill turns on a spring into the light Join waitlist tag, with a swinging bell.

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 button with seats" 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 button with seats running out</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: book. The button sits next to the seats left, which drop now and then; pressing it books one,
         and when the last seat goes the button turns into Join waitlist -->
    <div class="frame" data-inquadra>
      <p class="event">
        <b>Type at Night</b>
        <span>Lettering workshop, Thu Nov 14, 7 pm</span>
      </p>

      <div class="row">
        <button class="book" type="button" data-book aria-describedby="nota">
          <span class="book__bg" data-bg aria-hidden="true"></span>
          <span class="book__fill" data-fill aria-hidden="true"></span>
          <span class="ico" aria-hidden="true">
            <svg class="ico__arrow" data-arrow viewBox="0 0 20 20"><path d="M4 10h11"></path><path d="m10.6 5.6 4.4 4.4-4.4 4.4"></path></svg>
            <svg class="ico__spin" data-spin viewBox="0 0 20 20"><path d="M10 3.6a6.4 6.4 0 1 1-6.4 6.4"></path></svg>
            <svg class="ico__check" data-check viewBox="0 0 20 20"><path d="m5 10.4 3.2 3.1L15.2 6.6"></path></svg>
            <svg class="ico__bell" data-bell viewBox="0 0 20 20"><path d="M6 13.6V9.2a4 4 0 0 1 8 0v4.4l1.2 1.2H4.8Z"></path><path d="M8.6 16.8a1.5 1.5 0 0 0 2.8 0"></path></svg>
          </span>
          <span class="labels" data-labels>
            <span class="label" data-l="book">Book a seat</span>
            <span class="label" data-l="busy">Booking</span>
            <span class="label" data-l="in">You’re in</span>
            <span class="label" data-l="wait">Join waitlist</span>
            <span class="label" data-l="listed">On the waitlist</span>
          </span>
        </button>

        <div class="seats" data-seats aria-live="polite">
          <span class="seats__n"><span class="roll" data-roll><span class="digit" data-digit>4</span></span><span class="word" data-word>left</span></span>
          <span class="bar" aria-hidden="true"><span class="bar__fill" data-bar></span></span>
        </div>
      </div>

      <p class="note" id="nota" data-note>
        <span class="note__t" data-note-t="book">Free cancellation until Nov 12</span>
        <span class="note__t" data-note-t="in">Ticket sent. See you on Nov 14</span>
        <span class="note__t" data-note-t="wait">Sold out. Get the next free seat</span>
        <span class="note__t" data-note-t="listed">We’ll email you if a seat frees up</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.

25 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 button with seats” 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, the name of an invented workshop, Type at Night, with the date in grey; below, the black Book a seat pill with its arrow and beside it the seats count, «4 left», with a thin bar showing how many remain out of twelve. Now and then someone else books: the digit rolls down, the count gives a small sideways jolt and the bar gets shorter; under three seats the count and the bar turn orange. On hover the arrow moves forward three pixels and the black lightens a little; pressed, the button squashes and comes back with an elastic, the label becomes Booking, the arrow gives way to a spinning arc and the background fills with orange from the left. At the end the check draws itself, You’re in arrives, the pill takes a small breath and the count drops by one, yours; the line below says the ticket is on its way. When another visitor arrives and the last seats go, the black pill turns into a white outlined tag with less rounded corners, on a spring that stretches it for a moment: Join waitlist, with a swinging bell. Pressed, it says On the waitlist and takes a faint orange tint. A drawn pointer does it all by itself and starts again; it also really works with mouse, touch and keyboard.

How it works

Labels on top of each other

The button’s five labels all sit in the same box, in absolute position; the outgoing one rises and narrows on the wdth axis, the incoming one comes up narrow and widens with back.out, and the box width follows its measured offsetWidth, so the pill grows and shrinks on the same spring.

The rolling digit

The count is a one-line window with hidden overflow: on every change a new digit is born next to the old one, one comes in from above and the other leaves downwards. The bar is an element in scaleX going to seats left divided by total seats, with power3.out.

The fill and the check

The orange background is a layer under the label going from scaleX 0 to 1 over the loading time, while the arc spins with an endless tween; at the end the check is a stroke with a strokeDasharray that draws itself.

From pill to tag

When the seats reach zero the button changes shape: border-radius from 999 to 12 pixels, the background from black to white with a border made of an inset box-shadow, the text from white to black, and an elastic that stretches and squashes it for a moment. The bell swings with rotation keyframes.

The autopilot

A timeline takes the drawn pointer to the button reading its real position every time, presses it with the same functions as a click and makes the other visitors book with timed calls. At the first real touch it stops, and it starts again from the top after eight quiet seconds.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#f0531fThe colour filling the booked button and of the seats when they are few.
STARTscript.js4The seats left when the demo starts.
CAPACITYscript.js12The total seats: the bar is full when they are all free.
LOWscript.js3From how many seats down the count and the bar take the colour.
BOOK_TIMEscript.js0.9The seconds of loading before You’re in.
BOUNCEscript.js1.6How much the shape and the labels bounce.
PAUSEscript.js1.6The seconds the autopilot shows each state.

Try them in the Playground

When to use it

For the page of a workshop, a course, a concert or a dinner with limited seats, booking a gym class, a limited product drop: wherever knowing how many seats are left helps people decide.

On phones

The block is at most 92% of the screen wide; under 400 pixels the button drops to 44 pixels in height and 14 for the text and the line below to 12, so button and count stay on one row. A tap does what a click does.

With reduced motion

No bounces, jumps or rolls: labels, digit and icons change with a fade, the arc does not spin, the fill is almost instant, the shape changes without the elastic and the drawn pointer stays hidden.

Pitfalls

  • If the labels are measured before the real typeface arrives, the pill stays too narrow or too wide: it is measured again on document.fonts.ready and on resize.
  • The waitlist tag’s border is an inset box-shadow, not a border, which would change the button’s height by three pixels and make the row jump.
  • The shape change only starts if the seats run out while the button says Book a seat: someone who has already booked must not be offered the waitlist.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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