
The elastic button
Buttons, Hover, Text
The booking card of a hotel, on white, in the style of product interface pieces: the Check-in and Check-out field opens a one-month calendar in place of the bill. Once the arrival is picked, a terracotta ribbon follows the pointer to the day under your hand on a short spring; on the second click the calendar closes, both dates roll into the field letter by letter and nights, taxes and total count up to the price.
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>
<!--
"Stay date 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 stay date picker</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>
<!-- the booking card of an invented hotel: the dates field opens a one-month calendar in place of the price breakdown,
the stay is drawn as a ribbon from check-in to the day under the pointer, and on the second pick the dates roll into the field
while nights and total count up -->
<section class="stay" data-card aria-label="Casa Vellora booking">
<header class="stay__head">
<p class="stay__brand">Casa Vellora <span>Room with terrace</span></p>
<p class="stay__rate"><b data-rate>€180</b> night</p>
</header>
<div class="field" data-field>
<span class="field__pill" data-pill aria-hidden="true"></span>
<button class="field__half" type="button" data-half="in" aria-expanded="false" aria-controls="calendario">
<span class="field__label">Check-in</span>
<span class="field__val" data-val="in"><span>Add date</span></span>
</button>
<svg class="field__arrow" viewBox="0 0 24 12" aria-hidden="true"><path d="M2 6h19M16 1.5 21 6l-5 4.5"></path></svg>
<button class="field__half" type="button" data-half="out" aria-expanded="false" aria-controls="calendario">
<span class="field__label">Check-out</span>
<span class="field__val" data-val="out"><span>Add date</span></span>
</button>
</div>
<div class="body" data-body>
<div class="sum" data-sum>
<div class="perk">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.5 16 5v4.6c0 3.6-2.5 6.4-6 7.9-3.5-1.5-6-4.3-6-7.9V5Z"></path><path d="m7.2 10 2 2 3.8-4" data-perk-tick></path></svg>
<div><p class="perk__t">Free cancellation</p><p class="perk__s" data-perk><span>Cancel up to a day before check-in.</span></p></div>
</div>
<dl class="sum__rows" data-rows>
<div class="sum__row"><dt data-nights-label>€180 × 0 nights</dt><dd data-sub>€0</dd></div>
<div class="sum__row"><dt>Cleaning fee</dt><dd data-clean>€0</dd></div>
<div class="sum__row"><dt>Taxes</dt><dd data-tax>€0</dd></div>
<div class="sum__row sum__row--total"><dt>Total</dt><dd data-total>€0</dd></div>
</dl>
<button class="reserve" type="button" data-reserve><span class="reserve__txt" data-reserve-txt>Check availability</span></button>
<p class="sum__note">You won’t be charged yet</p>
</div>
<div class="cal" id="calendario" data-cal role="dialog" aria-label="Choose your dates">
<div class="cal__top">
<button class="cal__nav" type="button" data-prev aria-label="Previous month"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3 5 8l5 5"></path></svg></button>
<p class="cal__month" data-month><span></span></p>
<button class="cal__nav" type="button" data-next aria-label="Next month"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6 3 5 5-5 5"></path></svg></button>
</div>
<div class="cal__week" aria-hidden="true"><span>Mo</span><span>Tu</span><span>We</span><span>Th</span><span>Fr</span><span>Sa</span><span>Su</span></div>
<div class="cal__clip" data-clip></div>
</div>
</div>
</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>
</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.
41 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 “Stay date picker” from Animorio and fit it into my siteEvery day is the number of days since 1970 (Date.UTC divided by one day): arrival, departure and the day under the pointer compare with a less-than and a greater-than, with no time zones shifting the dates.
Under the grid of days there are six ribbon pieces, one per row. On every change the first and last day of the range in each row are found and GSAP takes the piece’s x and width to the new measures with back.out(1.5): the ribbon stretches and pulls back like an elastic band, and the pieces in later rows start 35 milliseconds later.
The white pill sits under the two halves of the field and slides by the distance between them, measured with offsetLeft; as it runs it stretches 5% towards where it is going and back, as if taking a run-up.
The new date is split into inline-block letters rising from under the edge with an 18 millisecond stagger, while the old one leaves upwards all together: the field stays 19 pixels tall and hides the rest.
The four figures are values on an object that GSAP takes to the new number in 0.9 seconds; on every frame they are rewritten in euros with toLocaleString. The button changes its label with a tween of the variable font’s wdth axis widening and coming back.
| Name | File | Default | What it changes |
|---|---|---|---|
NIGHTLY | script.js | 180 | The price of one night, in euros. |
CLEANING | script.js | 40 | The cleaning fee, charged once. |
TAX_RATE | script.js | 0.08 | The taxes, as a share of the stay. |
ACCENT | script.js | #e0603a | The colour of the picked days, the ribbon and the ready button. |
RIBBON_TIME | script.js | 0.38 | The seconds of the spring of the ribbon following the pointer. |
PAUSE | script.js | 1 | The seconds the autopilot waits between one gesture and the next. |
For booking a hotel, a holiday home or a farm stay, renting a car or a bike, and anywhere a range of dates is chosen: time off in a team app, a subscription, a trip.
The card takes the width of the box minus the margins; days are 26 to 36 pixels tall with 6.6vh, so the whole month fits even in a short box, and the field and button shrink with vh. A tap does what a click does; on a phone the ribbon follows the finger to the tapped day.
No springs and no slides: calendar and bill swap with a fade, the ribbon appears already at its size, dates and figures change without rolling and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.7 KB; the libraries: GSAP 28 KB.
Tested on 26 October 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.