Skip to content
animorio
IT
All components

Salon time picker

Pickers, Physics, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 14 KBGSAP 28 KBFreeDownload the zip

The time picker of Wren & Vale, a made-up hair salon, alone on white. The service, a 45 minute Cut & finish, is a terracotta block three quarters of an hour long, fixed in the middle like a lens: under it slides the stylist’s day, with the taken appointments hatched and dimmed. Drag it and throw it with a finger: it runs on its momentum and settles on a spring only where the cut fits, overshooting by a hair. Change stylist or day and the appointments swap, the open gaps line up again below and the block glides to the nearest one; Book confirms it with the tick.

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>
<!--
  "Salon time picker" 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 salon time picker with the haircut block that glides into the free gaps</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: slide the day under the haircut. The service is a block as long as its minutes, fixed in the
         middle like a lens; the day's timeline slides under it with inertia and only lets it settle where it fits,
         between the taken appointments. Change stylist or day and the bookings swap, the open gaps line up again
         and the block glides to the nearest one -->
    <section class="pick" data-pick aria-label="Book a cut and finish at Wren and Vale">
      <span class="pick__glow" data-glow aria-hidden="true"></span>

      <header class="head">
        <span class="mark" aria-hidden="true">
          <svg viewBox="0 0 24 24"><circle cx="6.6" cy="17.4" r="2.6"></circle><circle cx="6.6" cy="6.6" r="2.6"></circle><path d="M8.6 8.3 20 16.6M8.6 15.7 20 7.4"></path></svg>
        </span>
        <span class="head__t">
          <span class="head__brand">Wren &amp; Vale</span>
          <span class="head__svc">Cut &amp; finish</span>
        </span>
        <span class="head__meta">
          <span class="head__min"><span data-min>45</span>&nbsp;min</span>
          <span class="head__price">£<span data-price>58</span></span>
        </span>
      </header>

      <div class="stylists" role="radiogroup" aria-label="Stylist" data-stylists>
        <button class="sty" type="button" role="radio" aria-checked="true" data-sty="0">
          <span class="sty__av sty__av--a"><svg class="sty__ring" viewBox="0 0 40 40" aria-hidden="true"><circle class="sty__ring-base" cx="20" cy="20" r="18.5"></circle><circle class="sty__ring-on" cx="20" cy="20" r="18.5"></circle></svg><span class="sty__in">IR</span></span>
          <span class="sty__t"><span class="sty__name">Ines</span><span class="sty__role">Senior</span></span>
        </button>
        <button class="sty" type="button" role="radio" aria-checked="false" data-sty="1">
          <span class="sty__av sty__av--b"><svg class="sty__ring" viewBox="0 0 40 40" aria-hidden="true"><circle class="sty__ring-base" cx="20" cy="20" r="18.5"></circle><circle class="sty__ring-on" cx="20" cy="20" r="18.5"></circle></svg><span class="sty__in">TK</span></span>
          <span class="sty__t"><span class="sty__name">Theo</span><span class="sty__role">Stylist</span></span>
        </button>
        <button class="sty" type="button" role="radio" aria-checked="false" data-sty="2">
          <span class="sty__av sty__av--c"><svg class="sty__ring" viewBox="0 0 40 40" aria-hidden="true"><circle class="sty__ring-base" cx="20" cy="20" r="18.5"></circle><circle class="sty__ring-on" cx="20" cy="20" r="18.5"></circle></svg><span class="sty__in">MA</span></span>
          <span class="sty__t"><span class="sty__name">Mara</span><span class="sty__role">Director</span></span>
        </button>
      </div>

      <div class="days" role="radiogroup" aria-label="Day" data-days>
        <span class="days__hl" data-dayhl aria-hidden="true"></span>
        <button class="day" type="button" role="radio" aria-checked="false" data-day="0"><span class="day__w">Tue</span><span class="day__n">17</span><span class="day__bar" aria-hidden="true"><span data-bar></span></span></button>
        <button class="day" type="button" role="radio" aria-checked="false" data-day="1"><span class="day__w">Wed</span><span class="day__n">18</span><span class="day__bar" aria-hidden="true"><span data-bar></span></span></button>
        <button class="day" type="button" role="radio" aria-checked="true" data-day="2"><span class="day__w">Thu</span><span class="day__n">19</span><span class="day__bar" aria-hidden="true"><span data-bar></span></span></button>
        <button class="day" type="button" role="radio" aria-checked="false" data-day="3"><span class="day__w">Fri</span><span class="day__n">20</span><span class="day__bar" aria-hidden="true"><span data-bar></span></span></button>
        <button class="day" type="button" role="radio" aria-checked="false" data-day="4"><span class="day__w">Sat</span><span class="day__n">21</span><span class="day__bar" aria-hidden="true"><span data-bar></span></span></button>
      </div>

      <div class="rail" data-rail>
        <div class="tag" data-tag aria-hidden="true"><span class="tag__in" data-tagin><span data-tagtxt>14:15 – 15:00</span></span></div>
        <div class="rail__view" data-view tabindex="0" role="slider" aria-label="Start time" aria-valuemin="0" aria-valuemax="40" aria-valuenow="0" aria-valuetext="">
          <div class="rail__track" data-track>
            <div class="rail__lane" data-lane></div>
            <div class="rail__ticks" data-ticks></div>
          </div>
        </div>
        <div class="lens" data-lens aria-hidden="true">
          <span class="lens__shadow" data-lshadow></span>
          <span class="lens__span" aria-hidden="true"></span>
          <span class="lens__body" data-lbody>
            <span class="lens__sheen"></span>
            <span class="lens__grip lens__grip--l"></span>
            <span class="lens__txt" data-ltxt>45 min</span>
            <svg class="lens__tick" data-ltick viewBox="0 0 24 24"><path d="M5.5 12.6 10 17l8.6-9.6"></path></svg>
            <span class="lens__grip lens__grip--r"></span>
          </span>
        </div>
      </div>

      <div class="gaps">
        <span class="gaps__label" data-gapcount>4 open gaps</span>
        <div class="gaps__row" data-gaps></div>
      </div>

      <footer class="foot">
        <span class="sum" data-sum>
          <span class="sum__top" data-sumtop>Thu 19 Nov · Ines</span>
          <span class="sum__time" data-sumtime>14:15 – 15:00</span>
        </span>
        <button class="go" type="button" data-go>
          <span class="go__face">
            <span class="go__beam" data-beam aria-hidden="true"></span>
            <span class="go__sheen" aria-hidden="true"></span>
            <span class="go__labels" data-golabels>
              <span class="go__label" data-gl="idle"><span>Book with&nbsp;<span data-goname>Ines</span></span></span>
              <span class="go__label" data-gl="wait">Holding the chair</span>
              <span class="go__label" data-gl="done"><svg class="go__tick" viewBox="0 0 24 24" aria-hidden="true"><path data-gotick d="M5.5 12.6 10 17l8.6-9.6"></path></svg><span>Booked&nbsp;<span data-gotime>14:15</span></span></span>
              <span class="go__label" data-gl="full">No gap fits</span>
            </span>
          </span>
        </button>
      </footer>
    </section>

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

56 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 “Salon time picker” 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 ground there is only the salon card, white with a fine grain, a one pixel edge and soft layered shadows. At the top the scissors mark on a dark tile, Wren & Vale, the Cut & finish service and on the right 45 min and £58. Below, the three stylists, Ines, Theo and Mara, with their initials in a coloured circle and their role: the chosen one has a warm ground and a terracotta ring drawing itself around them. Then the five days from Tuesday 17 to Saturday 21 in a well, with a dark pill that springs onto the chosen day and under each number a short line as long as the day is free. In the middle, the day’s rail, from 9 to 19, in quarters of an hour with the hours written below: the taken appointments are hatched grey blocks. Fixed in the middle is the cut, a terracotta block with 45 min and a thin bracket marking the three quarters it takes; above it, the dark tag with the start and end time, tilting slightly at every quarter that goes by. Dragging the day stretches the block a hair; over an appointment it turns hatched and says Taken. Let go, the day runs on its momentum and a spring settles it on the nearest free gap, overshooting by a pixel; the block squashes and settles. Tapping the rail sends the block there, or to the nearest free gap. Below, the open gaps in a row: tap one and the block glides to it. Change stylist or day and the appointments leave and come back in a wave from the block outwards; if the block now sits on an appointment you see it, then it glides to the nearest gap, while the open gaps line up again: the ones that stay slide to their new place, the new ones pop in. Theo is full on Saturday: the block shakes its head and the button says No gap fits. Book with Ines holds the chair with a light running around its edge, then turns light with the tick and Booked 14:15, the tick draws itself in the block too, the card rises three pixels and settles and whatever was not chosen steps back. Tapped again, you are back to choosing. Left alone, a drawn pointer throws the day, picks Theo and Friday, taps an open gap and books.

How it works

The day under a still lens

The service block never moves: it is as wide as the quarters of an hour the service takes and sits in the middle of the rail. What moves is the day’s track, with x = half the window − (start + quarters / 2) × the width of a quarter. So the time tag stays put and reads even while the day is running.

The possible starts

From the appointments comes a list of free quarters, and from that the starts where the whole service fits (all its quarters free). Runs of consecutive starts are the open gaps shown below; the first of each run is its label.

Throw and spring

On release the speed is measured over the last 100 ms of the drag, the position is projected THROW seconds ahead and the nearest possible start is chosen. A spring integrated on every frame of GSAP’s ticker takes it there, in four small steps and with damping just under critical: the throw’s speed becomes its starting speed, so it overshoots by a pixel and settles.

The open gaps lining up again

When the stylist or the day changes, the labels are measured where they are, the new row is built reusing the ones that stay and each one starts from its old place (FLIP); the ones that go are taken out of the row and fade where they were, the new ones pop in.

First you see it, then it moves

The new appointments come back in a wave from the block outwards; if the block now sits on one it turns hatched and says Taken for a moment, then glides to the nearest open gap. You understand why it moved.

Values to change

NameFileDefaultWhat it changes
DURATIONscript.js45The minutes of the service: the block is that long, in quarters of an hour.
PRICEscript.js58The price of the service, in pounds.
OPEN_Hscript.js9The opening hour, where the rail begins.
CLOSE_Hscript.js19The closing hour, where the rail ends.
BOUNCEscript.js1How far the day overshoots the time and comes back as it settles.
THROWscript.js0.3How far the thrown day keeps running, in seconds of momentum.
BOOK_TIMEscript.js0.9The seconds the button holds the chair.
HOLDscript.js3.2The seconds the demo round leaves the booking in view.
LOOPscript.jstrueWhether the demo round starts again.

Try them in the Playground

When to use it

In the app or site of a hair salon, a barbershop, a beauty studio or a practice, when a service lasts longer than one slot: you see at once where it fits whole, instead of trying the times one by one.

On phones

A quarter of an hour takes 16 pixels instead of 18 and the card tightens in the low box; the narrow block loses the two grips at its sides. The finger drags and throws the day like the mouse, and a tap on the rail takes it there.

With reduced motion

No springs or throws: the day jumps to its place with a fade, the appointments and open gaps fade in and out, the button’s labels swap without rising.

Pitfalls

  • In the Book with Ines pill the inline-flex label’s gap added up with the space before the name, leaving a hole: the whole text sits in one span, with a non-breaking space.
  • On a phone a quarter of an hour is 16 pixels wide and the 45 minute block only 48: the two grips at its sides sat on the label. Under 60 pixels the block drops them (an is-narrow class, measured again on resize).
  • Dimming the whole row of days while booking turned the dark pill of the chosen day grey too: now only the things not chosen step back, one by one.
  • While the day glides the block passes over appointments: the Taken state only shows while dragging or at rest, or it would flicker at every pass.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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