Skip to content
animorio
IT
All components

Long table booking button

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

A made-up restaurant’s «Book a table» button, on black: on click the graphite pill widens and itself becomes the wooden top of a long table seen from above, with a warm light coming on underneath. Adding guests with minus and plus, the digits roll and the chairs come out from under the table on a spring, split between the two sides and spread out again, the odd one goes to the head. «Tonight 20:30» is the quick pick that makes the table longer and brings out Confirm; confirming tucks the chairs back under the table and closes the pill into «Table for 4 · 20: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>
<!--
  "Long table booking 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 table button with the pill that becomes the long table</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 restaurant's Book a table button: on click the pill itself turns into a long wooden table seen from above,
         the chairs come out from under it as guests are added, Tonight 20:30 is the quick pick, and Confirm
         tucks the chairs back in and closes the pill on the booking -->
    <div class="booker" data-booker>
      <div class="table" data-table>
        <span class="table__glow" data-glow aria-hidden="true"></span>
        <div class="chairs" data-chairs aria-hidden="true"></div>

        <div class="shell" data-shell>
          <span class="skin skin--ink" aria-hidden="true"></span>
          <span class="skin skin--wood" data-wood aria-hidden="true"><span class="skin__grain"></span></span>
          <span class="shell__shine" data-shine aria-hidden="true"></span>
          <span class="shell__edge" aria-hidden="true"></span>

          <button class="face face--idle" type="button" data-open data-autoclic aria-expanded="false" aria-controls="booking">
            <svg class="mini" viewBox="0 0 26 18" aria-hidden="true">
              <rect class="mini__top" x="3" y="5.5" width="20" height="7" rx="3.5"></rect>
              <path class="mini__chair" data-mini d="M8 2.6h3"></path>
              <path class="mini__chair" data-mini d="M15 2.6h3"></path>
              <path class="mini__chair" data-mini d="M8 15.4h3"></path>
              <path class="mini__chair" data-mini d="M15 15.4h3"></path>
            </svg>
            <span class="face__label">Book a table</span>
          </button>

          <div class="panel" id="booking" data-panel aria-hidden="true">
            <div class="stepper" data-stepper>
              <button class="step" type="button" data-minus aria-label="One guest fewer">
                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7.5 12h9"></path></svg>
              </button>
              <span class="count" aria-live="polite">
                <span class="count__win"><span class="count__roll" data-roll></span></span>
                <span class="count__word" data-word>guests</span>
              </span>
              <button class="step" type="button" data-plus aria-label="One guest more">
                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7.5 12h9M12 7.5v9"></path></svg>
              </button>
            </div>

            <button class="quick" type="button" data-quick aria-pressed="false">
              <span class="quick__day">Tonight</span>
              <span class="quick__time">20:30</span>
            </button>

            <button class="confirm" type="button" data-confirm aria-label="Confirm the booking" tabindex="-1">
              <span class="confirm__fill" data-confirm-fill aria-hidden="true"></span>
              <svg viewBox="0 0 24 24" aria-hidden="true"><path class="confirm__arrow" data-arrow d="M6 12h11.5M13 7.2l4.8 4.8-4.8 4.8"></path></svg>
            </button>
          </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>Table for 4 · 20:30</span>
          </div>
        </div>
      </div>
      <p class="note" data-note>Confirmation sent · <span>Osteria Lume</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.

24 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 “Long table booking 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 black there is a 60 pixel graphite pill, with a thread of light on its top edge, a small long table drawn in line with four chairs and the words «Book a table». On hover the pill grows a little, the label widens on the wdth axis, the drawn chairs move a pixel away and the backrests of two real chairs peek out from under the pill; pressed, it squashes. On click the label rises and fades, the pill widens on a spring and becomes the top of a wooden table seen from above, with its grain, a highlight crossing it and an amber light coming on underneath, on the black. On the wood there are minus, the number of guests with the word «guests» and plus, and the «Tonight 20:30» pill. The first two chairs come out from under the table one after the other, one per side. Every extra guest rolls the digit up, squashing it slightly, the top settles and a new chair comes out from under the table with a bounce while the others spread out again along the two sides; with an odd number the last one goes to the head of the table, turned. Removing a guest, the chair goes back under the table. Tapped, «Tonight 20:30» turns dark with a small bounce, the table gets longer and all the chairs slide to their new places, and at the end the round Confirm button pops out turning, with its arrow. Pressed, Confirm fills amber from the centre and the arrow leaves to the right; the chairs tuck under the table one after the other, the wood turns back to graphite, the light goes out and the pill closes into «Table for 4 · 20:30» with the amber check drawing itself; it sinks one pixel and comes back, and «Confirmation sent · Osteria Lume» appears below. A few seconds later «Book a table» comes back. The drawn pointer does it all by itself; Esc or a click outside closes the table.

How it works

One pill, two skins

The pill has two layers underneath: the graphite and the wood, made of two gradients, a radial highlight and two slightly tilted repeating-linear-gradients for the grain in multiply. Opening means animating the width on a back.out spring and fading the wood in, while a band of light crosses it once.

The chairs live under the table

The chairs are in a layer behind the pill, the same size as it. Each has two places: the outer one, 10 pixels from the edge, and the hidden one, 14 pixels inside. A new chair starts from the hidden one at full opacity and moves out with back.out: it seems to come from under the top, with no masks.

The seating is worked out again

A function gives, for n guests and a length, the place of every chair: even ones on top and odd ones below, spread between the two arcs of the pill, and with an odd number the last one at the head, turned by -90 degrees. Every chair is always the same element, so when the number or the length changes it slides from its old place to the new one on the same spring.

Rolling digits

Every number is a new span that comes in from below (or from above when removing) with yPercent and a 0.72 scaleY, while the old one leaves the other way and is removed. «guest» becomes «guests» and the buttons switch off at the limits; a tap past the limit makes the number shake.

Confirm and pilot

Confirm fills from the centre with a scale, the chairs go back in staggered, the pill is measured on the real text of «Table for 4 · 20:30» and the check draws itself with stroke-dashoffset. Measures are taken again on resize. A drawn pointer opens it, adds two guests, picks Tonight and confirms; at the first real touch it stops and starts again after eight quiet seconds.

Values to change

NameFileDefaultWhat it changes
SPRINGscript.js0.62Seconds of the spring that widens the pill into the table and closes it.
CHAIR_SPRINGscript.js0.5Seconds of the spring that brings a chair out from under the table or moves it.
HOLDscript.js2.8Seconds «Table for 4 · 20:30» stays before going back to «Book a table».
START_GUESTSscript.js2How many guests there are when the table opens.
MAX_GUESTSscript.js8The most guests, from 2 to 8.
QUICK_TIMEscript.js20:30The time of the «Tonight» quick pick.
ACCENTscript.js#ffb45eThe colour of the light under the table, of Confirm and of the check.
WOODscript.js#d8bc93The colour of the table’s wood.

Try them in the Playground

When to use it

On the site of a restaurant, an osteria, a bar or a venue: the button that opens a quick booking for tonight without going to another page. With another time it also suits a tasting or a dinner at an event.

On phones

The same animation: the open table is at most the screen width minus 32 pixels and the chairs spread along the real length. A tap is hover and click together; the buttons on the wood are 32 to 40 pixels.

With reduced motion

Nothing moves: the pill changes width in one step, the wood, the chairs, the digits and the check arrive with a fade, with no springs or bounces; the pilot’s pointer is hidden.

Pitfalls

  • Chairs in front of the pill had to be masked by hand: put in a layer behind it, it is enough to start them 14 pixels inside the edge and the top itself hides them.
  • A chair moving from the head of the table to a row must stay the same element: with new elements the head chair vanished and another was born, and the change looked like a jump.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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