Skip to content
animorio
IT
All components

Book a table guests button

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

A restaurant’s «Book a table» button in the style of product interface pieces, on white: on click the black pill opens in place and inside there is the table seen from above. Adding guests, the chairs come to the table on a spring and the plates are laid, the number rolls, the time is picked from a segmented row; Reserve fills green and the pill closes back 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>
<!--
  "Book a table guests 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 guests inside</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 in place: a table seen from above where the chairs come as you add guests,
         the time as a row of segments, and Reserve; it closes back into the pill with the booking in it -->
    <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="mini" data-mini viewBox="0 0 24 24" aria-hidden="true">
            <circle cx="12" cy="12" r="4.6"></circle>
            <path class="mini__chair" d="M10 3.6h4"></path>
            <path class="mini__chair" d="M10 20.4h4"></path>
            <path class="mini__chair" d="M3.6 10v4"></path>
            <path class="mini__chair" d="M20.4 10v4"></path>
          </svg>
          <span class="face__label">Book a table</span>
        </button>

        <div class="panel" id="panel" data-panel aria-hidden="true">
          <div class="row row--top" data-top>
            <svg class="table" data-table viewBox="0 0 64 64" aria-hidden="true">
              <g data-seats></g>
              <circle class="table__top" cx="32" cy="32" r="14.5"></circle>
              <circle class="table__shine" cx="32" cy="32" r="11.5"></circle>
              <g data-plates></g>
            </svg>

            <div class="guests">
              <p class="guests__label">Guests</p>
              <div class="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 12h10"></path></svg>
                </button>
                <span class="count" aria-live="polite"><span class="count__roll" data-roll></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 12h10M12 7v10"></path></svg>
                </button>
              </div>
            </div>

            <button class="reserve" type="button" data-reserve aria-label="Reserve">
              <span class="reserve__fill" data-reserve-fill aria-hidden="true"></span>
              <svg viewBox="0 0 24 24" aria-hidden="true"><path class="reserve__arrow" d="M6 12h11.5M13 7.2l4.8 4.8-4.8 4.8"></path></svg>
            </button>
          </div>

          <div class="times" role="radiogroup" aria-label="Time" data-times>
            <span class="times__pill" data-indicator aria-hidden="true"></span>
          </div>

          <p class="foot" data-foot>Friday 31 October · Café Vireo</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>Table for 4</span>
        </div>
      </div>
      <p class="note" data-note>Confirmation sent · <span>Café Vireo</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.

21 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 table guests 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 table, four chairs around it, and the words «Book a table». On hover it grows a little and the four chairs move a pixel and a half away from the table, as if pulled out; pressed, it squashes and its shadow tightens. On click the label fades and the pill opens in place on a short spring into a white capsule about 330 pixels wide, with a thin border: on the left the table seen from above, with a wood-coloured top, a highlight and six places marked by a dashed outline; in the middle «Guests» with minus, the number and plus; on the right the black Reserve button with its arrow; below, the times 19:00, 19:30, 20:00 and 20:30 in a segmented row with a white pill as the indicator, and at the bottom «Friday 31 October · Café Vireo». The chairs of the first two guests arrive one after the other, facing each other, and a plate is laid in front of each. Every time a guest is added a chair slides to the table on a spring and its dashed outline fades, the plate arrives with a small bounce, the table top settles and the number rolls up, squashing slightly; removing one, the chair moves away and fades. From five people 20:00 is full: the time gets struck through and, if it was the chosen one, the indicator moves to the next; tapped, it shakes its head. The indicator slides with a small bounce onto the chosen time, which rises one pixel and comes back. On Reserve the arrow nudges forward; pressed, the button squashes and fills green from the centre, the arrow leaves to the right, the content rises and fades, the capsule closes into a black pill that reads «Table for 4 · 20:30» with the green check drawing itself; the pill sinks one pixel and comes back, and «Confirmation sent · Café Vireo» appears below. After a few seconds «Book a table» comes back. The drawn pointer does it all by itself; Esc or a click outside closes the capsule.

How it works

One shell that changes shape

Button and capsule are the same element: a shell with hidden overflow whose width, height and corners GSAP takes from the pill’s size to the capsule’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 table in SVG

Six places around the top, each a group moved and turned towards the centre: inside there is the dashed outline and a group with the chair, which GSAP takes from y minus 5 and scale 0.6 to zero and one with back.out. The chairs are taken in a fixed order (two facing each other, then filling in), the plates are circles growing from their centre.

The rolling number

The number is a column of digits from 1 to 6 in a one-line window: to show n the column rises by n minus one lines with back.out, and meanwhile squashes slightly in height around the right digit, so you feel it roll.

Times and full slots

The indicator is a white pill in absolute position with the x and width of the chosen time, read with offsetLeft and offsetWidth. A time can have a limit on guests: past it, it is struck through and the indicator moves to the first free time after it.

From the choice to the booked pill

A single timeline: Reserve squashes and fills green from the centre, the arrow leaves, the content rises and fades, the shell becomes a pill as wide as «Table for 4 · 20:30», the check draws itself with strokeDashoffset and the pill sinks a pixel and rises again. A delayedCall brings back «Book a table»; the autopilot awaits the tweens as promises and stops at the first real touch.

Values to change

NameFileDefaultWhat it changes
SPRINGscript.js0.55How long the spring that opens and closes the pill lasts, in seconds.
CHAIR_SPRINGscript.js0.45How long the spring that brings a chair to the table lasts, in seconds.
HOLDscript.js2.6How many seconds the booking stays before «Book a table» comes back.
START_GUESTSscript.js2How many guests there are when it opens.
MAX_GUESTSscript.js6The most guests, from 2 to 6.
INKscript.js#0a0a0aThe colour of the pill, the chairs and the Reserve button.
WOODscript.js#e9e2d6The colour of the table top.
CHECK_COLORscript.js#4ade80The colour of the check and of Reserve when it confirms.
OPEN_WIDTHscript.js330How wide the open pill is, in pixels (it narrows if the window is narrower).

Try them in the Playground

When to use it

For the «Book a table» button on the site of a restaurant, a bistro or a café, or in a booking app: whoever presses it picks how many people and what time without leaving the page, and the button itself remembers the booking.

On phones

The capsule takes at most the width of the box minus the margins and measures its own height; plus, minus and the times are at least 28 pixels tall and a tap does what a click does.

With reduced motion

The pill neither stretches nor bounces: it becomes a capsule and a pill again at once, the chairs and plates fade in in place, the number changes without rolling, the indicator jumps into place, the check is already drawn and the drawn pointer is not shown.

Pitfalls

  • The chairs sit in a group that already has its own transform attribute (place and rotation): GSAP animates a child group, otherwise its transform would wipe out the place’s.
  • 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 smudges the border.
  • The capsule is measured with the panel already as wide as it will be, after document.fonts.ready: measured earlier, the lines wrapped somewhere else.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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