Skip to content
animorio
IT
All components

Restaurant booking nav

Navigation, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 10 KBGSAP 28 KBFreeDownload the zip

The navigation bar of Salvia, an invented restaurant, in warm glass on white: the leaf brand, Menu, Wine, Story and the olive green ‘Book a table’ button. Pressed, the button becomes a cross and the bar itself grows on a spring into the small booking form: a real photo of the sunlit room, guests, day and time on three rows of pills with a puck that stretches and slides, and Reserve summing up the choice. Booked, it spins, draws a check and says Confirmed; the bar closes back and keeps the booking on its button for a moment, then Book a table comes back.

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>
<!--
  "Restaurant booking nav" 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 restaurant nav that opens into the booking</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the navigation bar of Salvia, a restaurant: Menu, Wine, Story and the Book a table button. Pressed, the button
         stays where it is and the bar itself opens on a spring into the booking: a photo of the room, guests, day and
         time on three sliding pills, and Reserve. Confirmed, the bar closes back and keeps the booking on its button -->
    <nav class="bar" data-bar aria-label="Salvia">
      <div class="bar__glass" data-glass>
        <div class="bar__row">
          <a class="brand" href="#" aria-label="Salvia, home">
            <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
              <path class="brand__stem" d="M12 21.2V8.6"/>
              <path class="brand__leaf" data-leaf d="M12 13.6c-3.9-.3-6.3-2.6-6.6-6.4 3.9.2 6.3 2.5 6.6 6.4z"/>
              <path class="brand__leaf" data-leaf d="M12 10.4c3.6-.4 5.8-2.6 6.1-6.1-3.6.3-5.8 2.5-6.1 6.1z"/>
              <path class="brand__leaf" data-leaf d="M12 17.6c3-.3 4.9-2 5.2-5-3 .3-4.9 2-5.2 5z"/>
            </svg>
            <span class="brand__name">Salvia</span>
          </a>

          <div class="bar__mid">
            <ul class="links" data-links>
              <li><a class="links__a" href="#" data-link>Menu</a></li>
              <li><a class="links__a" href="#" data-link>Wine</a></li>
              <li><a class="links__a" href="#" data-link>Story</a></li>
            </ul>
            <p class="bar__title" data-title aria-hidden="true">
              <span class="bar__title-main">A table at Salvia</span>
              <span class="bar__title-sub">Garden room, open till 23:00</span>
            </p>
            <p class="bar__booked" data-booked aria-hidden="true">
              <svg viewBox="0 0 16 16" aria-hidden="true"><path data-booked-check pathLength="1" stroke-dashoffset="1" d="M3.2 8.5l3 3 6.6-7"/></svg>
              <span data-booked-words>Sat 7, 20:00, table for 4</span>
            </p>
          </div>

          <button class="book" type="button" data-book aria-expanded="false" aria-controls="booking">
            <span class="book__shine" aria-hidden="true"></span>
            <span class="book__words" data-book-words>Book a table</span>
            <svg class="book__icon" viewBox="0 0 16 16" aria-hidden="true">
              <path class="book__plus" data-book-a d="M8 3.2v9.6"/>
              <path class="book__plus" data-book-b d="M3.2 8h9.6"/>
              <path class="book__check" data-book-check pathLength="1" stroke-dashoffset="1" d="M3.2 8.5l3 3 6.6-7"/>
            </svg>
          </button>
        </div>

        <div class="booking" id="booking" data-booking inert>
          <figure class="room" data-room>
            <div class="room__frame" data-room-frame>
              <img class="room__img" data-room-img src="sala.webp" alt="A table laid in the sun by a stone wall, wine glasses and lavender" width="1024" height="683" decoding="async">
            </div>
            <figcaption class="room__tag" data-part>
              <span class="room__tag-name">The garden room</span>
              <span class="room__tag-left" data-left>6 tables left tonight</span>
            </figcaption>
          </figure>

          <form class="form" data-form>
            <div class="row" role="group" aria-labelledby="l-guests" data-part>
              <span class="row__label" id="l-guests">Guests</span>
              <div class="seg" data-seg="guests">
                <span class="seg__puck" aria-hidden="true"></span>
                <button type="button" class="seg__opt" aria-pressed="false">1</button>
                <button type="button" class="seg__opt" aria-pressed="true">2</button>
                <button type="button" class="seg__opt" aria-pressed="false">3</button>
                <button type="button" class="seg__opt" aria-pressed="false">4</button>
                <button type="button" class="seg__opt" aria-pressed="false">5</button>
                <button type="button" class="seg__opt" aria-pressed="false">6</button>
              </div>
            </div>
            <div class="row" role="group" aria-labelledby="l-day" data-part>
              <span class="row__label" id="l-day">Day</span>
              <div class="seg" data-seg="day">
                <span class="seg__puck" aria-hidden="true"></span>
                <button type="button" class="seg__opt" aria-pressed="true">Today</button>
                <button type="button" class="seg__opt" aria-pressed="false">Sat 7</button>
                <button type="button" class="seg__opt" aria-pressed="false">Sun 8</button>
                <button type="button" class="seg__opt" aria-pressed="false">Tue 10</button>
              </div>
            </div>
            <div class="row" role="group" aria-labelledby="l-time" data-part>
              <span class="row__label" id="l-time">Time</span>
              <div class="seg" data-seg="time">
                <span class="seg__puck" aria-hidden="true"></span>
                <button type="button" class="seg__opt" aria-pressed="true">19:30</button>
                <button type="button" class="seg__opt" aria-pressed="false">20:00</button>
                <button type="button" class="seg__opt" aria-pressed="false">20:30</button>
                <button type="button" class="seg__opt" aria-pressed="false" disabled aria-label="21:15, full">21:15</button>
              </div>
            </div>

            <div class="send" data-part>
              <button class="reserve" type="button" data-reserve>
                <span class="reserve__shine" aria-hidden="true"></span>
                <span class="reserve__words" data-reserve-words>Reserve</span>
                <span class="reserve__sum" data-sum>Today, 19:30, 2 guests</span>
                <svg class="reserve__icon" viewBox="0 0 20 20" aria-hidden="true">
                  <path class="reserve__arrow" data-r-arrow d="M4 10h11M11 5.6L15.4 10 11 14.4"/>
                  <circle class="reserve__spin" data-r-spin cx="10" cy="10" r="6.4" pathLength="1"/>
                  <path class="reserve__check" data-r-check pathLength="1" stroke-dashoffset="1" d="M4.6 10.4l3.6 3.6 7.4-8"/>
                </svg>
              </button>
            </div>
          </form>
        </div>
      </div>
    </nav>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

47 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 “Restaurant booking nav” 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 a white page a navigation bar of warm glass drops in from the top on a spring, with a thin edge, a line of light along the top, a light grain and soft layered shadows. On the left the Salvia brand, a sprig with three leaves (one terracotta) and the name in a serif; in the middle Menu, Wine and Story, which widen on hover and get a light pill behind them; on the right the olive green ‘Book a table’ button with a plus, crossed by a glint. Pressed, the button gives and comes back, the words close up and the plus turns into a cross: a round button to close is left. Meanwhile the links leave upwards, ‘A table at Salvia’ with the room's hours takes their place, and the bar widens and grows down on a spring that passes the mark by a pixel and settles, warming slightly in one corner. Inside, the real photo of the sunlit room uncovers from the top and settles with a small zoom, with the glass tag ‘The garden room, 6 tables left tonight’; beside it three rows of pills, Guests from 1 to 6, Day with Today, Sat 7, Sun 8 and Tue 10, Time with 19:30, 20:00, 20:30 and 21:15 already full and struck through, and the Reserve button summing up the choice. The pilot picks 4 guests, Saturday 7 and 20:00: at each choice the white puck stretches over both pills and then lets go of the old one on a spring, the chosen word gains weight and the summary rolls to its new text. Reserve pressed, the label becomes Booking and an arc spins; then a check draws itself, Confirmed, a glint crosses the button, the photo lights up for an instant and the free tables go down to 5. The bar closes back, ‘Sat 7, 20:00, table for 4’ appears in the middle with a check and the button says ‘Sat 7, 20:00’ with its own check; after a moment the links and Book a table come back, and the loop starts again.

How it works

The bar that becomes the form

The form is already inside the bar, hidden (display none and inert). On opening the script adds the is-open class, measures the width and height the open bar will have, puts it straight back to the closed size in pixels and takes it to the new one with two tweens on the same spring; at the end width and height go back to auto, so the bar survives a window change. Closing does the opposite, starting from the sizes of that moment.

The button that becomes a cross

The Book a table label is a span with overflow hidden: its width goes to zero while the two strokes of the plus turn 45 degrees, four hundredths apart, and the button is left as a 40 pixel circle. To come back, the right width of the new label is measured on a hidden copy, so the button also stretches to ‘Sat 7, 20:00’.

The puck that stretches

Each row of pills has a single white puck in absolute position. On a choice GSAP stretches it in 0.17 s over both the old and the new pill, then takes it to the new one (x and width measured with offsetLeft and offsetWidth) on the spring: it looks like it peels off the old one. A ResizeObserver puts it back when the bar changes width.

A real spring as an ease

Every opening uses a hand written ease function: the response of a damped spring (damping 0.72) normalised between 0 and 1, passing the mark by a pixel or two and settling. The same function with higher damping brings the words in.

The confirmation

Reserve has three marks in one SVG: the arrow, an arc with pathLength 1 and a 0.28 dasharray that spins while it ‘books’, and the check that draws itself by animating the stroke-dashoffset attribute. An oblique gradient moved by a CSS variable makes the glint; the photo has a warm glow in a radial-gradient over it, lit for an instant with another variable.

Values to change

NameFileDefaultWhat it changes
PICK_GUESTSscript.js4The guests the pilot picks (1 to 6).
PICK_DAYscript.jsSat 7The day the pilot picks: Today, Sat 7, Sun 8 or Tue 10.
PICK_TIMEscript.js20:00The time the pilot picks: 19:30, 20:00 or 20:30 (21:15 is full).
TABLES_LEFTscript.js6The free tables written on the photo: one goes with each booking.
BOUNCEscript.js0.72The springs: lower bounces more (0.5), higher settles without passing the mark (1).
BOOKED_HOLDscript.js2.6The seconds the closed bar keeps the booking on its button.
LOOPscript.jstrueThe pilot books again until someone touches the bar.

Try them in the Playground

When to use it

At the top of the site of a restaurant, a trattoria, a bar with a kitchen or a wine bar: booking happens without changing page and without a panel covering everything, inside the bar itself, and after the confirmation the bar remembers it. The same gesture suits a hotel (nights and rooms), a spa, a hair salon or any site where the main action is booking.

On phones

The same animation with adapted sizes: the bar is 92% of the screen wide and under 500 pixels the Menu, Wine and Story links leave just the brand and the button; open, the photo goes above the form in a band at most 16% of the screen tall, and the pills are tapped with a finger. Everything stays inside the frame even when open.

With reduced motion

Nothing moves: the bar fades in, opens and closes at once with the photo and the pills fading, the puck jumps to the chosen pill, the arc does not spin and the words and checks change with a fade.

Pitfalls

  • With overflow hidden on the bar the pills of the closed form could still be reached with Tab: the form is inert until the bar is open, and display none when closed.
  • The pill puck is measured in pixels, but the hidden form has zero width: the sizes are taken after adding is-open, before the bar starts growing, and again with a ResizeObserver.
  • The open bar's width is in CSS (min(640px, 92vw)) and a container query changes the layout under 500 pixels: to know where to go the script adds the class, reads the size and puts it back in the same frame, unseen.
  • GSAP cannot tween back to an auto width: the button label goes to a width measured on a hidden copy and only at the end returns to auto.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.

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

Testing

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