Skip to content
animorio
IT
All components

Add to calendar button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 7.3 KBGSAP 28 KBFreeDownload the zip

The button to add a made-up concert, Low Tide Sessions, to your calendar, on black: a graphite pill with the calendar icon on the left and, on the right, a little paper page with the month in red and the day, 26. Pressed, the page peels off, folds in half along a crease that darkens, flies in an arc over the label and slides into the icon, which opens its page and closes it back over it with a bounce, now with the date printed on. The button becomes Added with a check drawing itself and the line with day and time; a second click plays the same gesture backwards.

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>
<!--
  "Add to calendar 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 Add to calendar button with the date page that folds into the icon</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>
    <!-- an event page's Add to calendar button: the little date page peels off the pill,
         folds in half and slides into the calendar icon, whose page closes over it -->
    <button class="btn" type="button" data-btn data-autoclic aria-pressed="false"
      aria-label="Add Low Tide Sessions, Thursday November 26 at 8:30 PM, to your calendar">
      <span class="btn__light" aria-hidden="true"></span>

      <span class="cal" aria-hidden="true">
        <span class="cal__body" data-body>
          <span class="cal__pocket"></span>
        </span>
        <span class="cal__ring cal__ring--a"></span>
        <span class="cal__ring cal__ring--b"></span>
        <span class="cal__lid" data-lid>
          <span class="face face--grid" data-face-grid>
            <span class="face__band"></span>
            <span class="face__rows"></span>
          </span>
          <span class="face face--date" data-face-date>
            <span class="face__band face__band--on" data-mon-small>NOV</span>
            <span class="face__day" data-day-small>26</span>
            <span class="face__shine" data-shine></span>
          </span>
          <span class="face face--back"></span>
        </span>
      </span>

      <span class="btn__words">
        <span class="btn__row" data-idle>
          <span class="btn__label">Add to calendar</span>
          <span class="btn__sub" data-where>Low Tide Sessions · Halden Hall</span>
        </span>
        <span class="btn__row" data-done aria-hidden="true">
          <span class="btn__label">Added</span>
          <span class="btn__sub" data-when>Thu, Nov 26 · 8:30 PM</span>
        </span>
      </span>

      <span class="btn__side" aria-hidden="true">
        <span class="chip__shadow" data-chip-shadow></span>
        <span class="chip" data-chip>
          <span class="chip__half chip__half--bottom" data-bottom>
            <span class="chip__sheet">
              <span class="chip__band" data-mon>NOV</span>
              <span class="chip__day" data-day>26</span>
            </span>
            <span class="chip__crease" data-crease></span>
          </span>
          <span class="chip__half chip__half--top" data-flap>
            <span class="chip__front">
              <span class="chip__sheet">
                <span class="chip__band" data-mon>NOV</span>
                <span class="chip__day" data-day>26</span>
              </span>
              <span class="chip__gloss" data-gloss></span>
            </span>
            <span class="chip__back"></span>
          </span>
        </span>
        <svg class="tick" viewBox="0 0 24 24" data-tick>
          <path class="tick__ring" d="M12 3.4a8.6 8.6 0 1 1 0 17.2a8.6 8.6 0 1 1 0-17.2" data-tick-ring/>
          <path class="tick__mark" d="M7.6 12.4l2.9 2.9l5.9-6.2" data-tick-mark/>
        </svg>
      </span>
    </button>
    <p class="sr" data-live aria-live="polite"></p>

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

24 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 “Add to calendar 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

A 60 pixel graphite pill, with a thread of light on its top edge. On the left the calendar icon: a dark body with two metal rings and a grid page with the red band; in the middle «Add to calendar» and under it, in grey, «Low Tide Sessions · Halden Hall»; on the right a little paper page with the month, NOV, on the red band and the day, 26. On hover (or with the Tab key) the page lifts its top half a little as if to peel off, a warm light follows the pointer and the label widens on the wdth axis; pressed, the pill sinks a hair. On click the page rises and tilts with its shadow, the icon opens its page upwards over the rings and the little page folds in half: the top half falls forward, shows its ruled back and the crease darkens. Folded, it flies in an arc over the label, which makes room by rising, and drops into the icon’s pocket; the page closes back over it with a bounce, now white with NOV and 26, the icon’s body squashes and recovers, a glint crosses the date. Meanwhile «Added» arrives with «Thu, Nov 26 · 8:30 PM» in pink, a thin ring and the check draw themselves where the page was, and a red rim lights up around the pill. A second click plays it all backwards, a little quicker: the check erases, the page opens again, the little page comes out, flies back, unfolds and settles.

How it works

One page in two halves

The little page is made of two 18 pixel halves holding the same whole page, shifted: the bottom one shows the lower half of the 26, the top one has a front and a back with backface-visibility hidden. Turning the top half by -180 degrees on the x axis, pivoting on its bottom edge, folds the page in half and shows its ruled back, as in the digits of a split-flap clock.

The icon’s page has two faces

The icon’s page is hinged on top and turns in 3D with its own perspective: at 126 degrees it is open towards the viewer and its back shows. Right as the page arrives, while the front face is turned away, the grid page gives way to the one with the date: closing again it shows NOV and 26 with no visible swap.

Who sits on top of whom

The icon’s body, the little page and the icon’s page are siblings in the same stack with z-index 1, 2 and 3, and the icon itself is never transformed (it would make its own layer): so the page flies over the label, goes in front of the bottom of the pocket and stays under the page that closes.

The measured flight

The landing point is measured with getBoundingClientRect between the centre of the little page and the pocket; the flight is two half runs per axis, x first slow then braking, y first up then down, so the arc comes by itself. On resize, at rest, the timeline is rebuilt with the new measures and resumes where it was.

Forwards and backwards with one timeline

The whole gesture is one paused timeline: the first click plays it, the second plays it backwards with timeScale 1.18, so the way back really is the same gesture in reverse, even if interrupted halfway. aria-pressed tells the state and an aria-live line announces the add or the removal.

Values to change

NameFileDefaultWhat it changes
FOLDscript.js0.46Seconds for the date page to fold in half.
FLIGHTscript.js0.62Seconds of the folded page’s flight to the icon.
LID_BOUNCEscript.js1.6How much the icon’s page bounces as it closes (0 crisp).
ARCscript.js15How high the flight’s arc rises, in pixels.
HOLDscript.js3.2Seconds the autopilot leaves «Added» before removing it.
PRESS_SCALEscript.js0.972How far the pressed button sinks.
ACCENTscript.js#ff5a43The accent colour: the month band, the check and the rim.

Try them in the Playground

When to use it

On the page of a concert, a conference, a class or a booking: the button that puts the event in the visitor’s calendar. Changing month and day on the little page, it suits any reminder with a date.

On phones

The same animation: the pill is at most the screen width minus 32 pixels, the icon and the little page keep their size and the flight is measured again on the real width. A tap is hover and click together.

With reduced motion

Nothing moves or folds: the little page fades away, the date fades in on the icon, «Added» and the check arrive already drawn; the second click plays the same fades backwards. The pilot’s pointer is hidden.

Pitfalls

  • With a transform on the whole icon (to make it bounce) the icon became a layer of its own and the page went entirely over or entirely under it: only the body bounces, and body, page and icon page stay siblings with z-index 1, 2 and 3.
  • Opened to 168 degrees the icon’s page was a dark rectangle as tall as the icon above the pill, and could not be read: at 126 degrees it stays foreshortened towards the viewer and reads as a lifted page.
  • The label left halfway through the flight and the page passed over it covering the letters: now it rises away a moment before the page leaves, and «Added» comes in as the page drops into the pocket, so the pill is never empty.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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