Skip to content
animorio
IT
All components

Request time off button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 5.0 KBGSAP 28 KBFreeDownload the zip

The time-off button in a team’s app: a violet pill with a small calendar, the dates asked for and the days left. Pressed, the days asked for light up one at a time in the small calendar and each comes off the balance on the right, which counts down; at the end the label says the request is sent and awaiting approval.

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>
<!--
  "Request time off 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>Request time off button with the days that come off the balance</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">
    <!-- the time-off button of a team's app: pressed, the days asked for light up one by one in the little
         calendar and each one comes off the balance on the right; then the label says the request is sent -->
    <button class="off" type="button" data-off>
      <span class="off__body" aria-hidden="true"><span class="off__sheen" data-sheen></span><span class="off__light"></span></span>
      <span class="off__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <rect x="3.6" y="5.2" width="16.800" height="14.800" rx="3.4"></rect>
          <path d="M8 3.400v3.400M16 3.400v3.400M3.600 9.800h16.800"></path>
          <g data-days></g>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Request time off</span></span>
        <span class="label__sub"><span data-sub>Mon 24 to Wed 26</span></span>
      </span>
      <span class="tag" data-tag aria-hidden="true"><span data-left>18 left</span></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.

13 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 “Request time off 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

In the centre, on black, a violet pill 60 pixels tall with a glow and an edge that catches the light: on the left, in a white seat, a small outline calendar with five short marks (the week), then two lines (“Request time off” and below the dates, “Mon 24 to Wed 26”) and on the right a tag with “18 left”. Pressed, the label rolls to “Requesting” and three of the calendar’s marks light up one after the other with a little hop: at each day the tag takes the hit and the balance drops (17, 16, 15 left). Then the seat turns dark, the tag white, a sheen crosses the pill and the label says “Request sent”, with “3 days, awaiting approval” below. After a couple of seconds it goes back.

How it works

The week

The calendar’s five marks are SVG paths created by the script. A timeline lights the first DAYS of them, one every BEAT seconds: a class changes the stroke colour, and the mark hops 2.2 units and returns on a spring.

The balance

At the same instant the tag squashes slightly and bounces, and its text rolls to the new number: the balance is BALANCE minus the days lit so far, so calendar and number cannot say two different things.

The close

A class on the button darkens the seat and whitens the tag, seat and pill make a small elastic bounce and a slanted sheen crosses the pill; the two lines roll to the new text.

Values to change

NameFileDefaultWhat it changes
DAYSscript.js3How many days off are asked for (1 to 5).
BALANCEscript.js18The days off left before the request.
RANGEscript.jsMon 24 to Wed 26The dates written below (invented).
BEATscript.js0.42How many seconds between one day and the next.
ACCENTscript.js#6f5cffThe pill’s colour.
HOLDscript.js2.6On its own: how many seconds it stays on “Request sent” before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

For a company’s HR app, the back office of a studio or a shop: the button at the end of the time-off form, which shows at once how much is left. In a real product the dates come from the calendar chosen earlier and the balance from the server.

On phones

The same button: the pill takes at most the screen width minus the margins; it is pressed with a finger and there is no light under the pointer.

With reduced motion

No hops, bounces or sheen: the marks light up and the balance changes in place, then the labels change without moving.

Pitfalls

  • The balance never goes below zero: the days asked for are capped at five and the starting balance is at least the days asked for.
  • There are no dots in the calendar: the days are short marks, and the ones asked for change colour and weight, not shape.
  • While requesting the button takes no other press (aria-busy), and a line for screen readers says days, dates and balance left.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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