
The slide-to-confirm button
Buttons, Physics, Transitions
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.
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 & Vale</span>
<span class="head__svc">Cut & finish</span>
</span>
<span class="head__meta">
<span class="head__min"><span data-min>45</span> 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 <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 <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>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
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 siteThe 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.
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.
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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
DURATION | script.js | 45 | The minutes of the service: the block is that long, in quarters of an hour. |
PRICE | script.js | 58 | The price of the service, in pounds. |
OPEN_H | script.js | 9 | The opening hour, where the rail begins. |
CLOSE_H | script.js | 19 | The closing hour, where the rail ends. |
BOUNCE | script.js | 1 | How far the day overshoots the time and comes back as it settles. |
THROW | script.js | 0.3 | How far the thrown day keeps running, in seconds of momentum. |
BOOK_TIME | script.js | 0.9 | The seconds the button holds the chair. |
HOLD | script.js | 3.2 | The seconds the demo round leaves the booking in view. |
LOOP | script.js | true | Whether the demo round starts again. |
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.
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.
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.
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.
Tested on 16 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.