Skip to content
animorio
IT
All components

Vacation hold toggle

Toggles, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.1 KBGSAP 28 KBFreeDownload the zip

The settings card of a coffee subscription, like a Dribbble shot: dark body, a one pixel edge, layered shadows. The Vacation hold switch has a glass track and a brushed metal knob that widens under the finger and runs on a spring. Turned on, amber fills the glass, the card warms from its corner, the suitcase lifts its handle, the away dates open, the next two deliveries are crossed out one after the other and the next charge rolls to its new date.

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>
<!--
  "Vacation hold toggle" 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 Vacation hold toggle with the deliveries that pause</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 settings card of a coffee subscription. The Vacation hold switch has a glass track and a metal knob that
         runs on a spring; turning it on the card warms up, the away dates open under the title, the next deliveries
         are skipped one after the other and the next charge rolls into the date the boxes start again -->
    <div class="wrap" data-wrap>
      <section class="card" data-card aria-labelledby="vh-title">
        <i class="card__glow" data-glow aria-hidden="true"></i>
        <i class="card__edge" data-edge aria-hidden="true"></i>

        <header class="head">
          <span class="tile" data-tile aria-hidden="true">
            <svg class="tile__bag" viewBox="0 0 28 28" data-bag>
              <path class="tile__handle" data-handle d="M10.6 8.4V6.6a1.8 1.8 0 0 1 1.8-1.8h3.2a1.8 1.8 0 0 1 1.8 1.8v1.8"/>
              <rect x="5" y="8.4" width="18" height="13.6" rx="3"/>
              <path d="M9.6 8.4v13.6M18.4 8.4v13.6"/>
              <path class="tile__wheel" d="M8.6 24.6h.01M19.4 24.6h.01"/>
            </svg>
          </span>
          <div class="head__copy">
            <h2 class="head__title" id="vh-title">Vacation hold</h2>
            <p class="head__sub">
              <span class="roll" data-sub>
                <span class="roll__face" data-sub-off>Pause your deliveries while you&rsquo;re away</span>
                <span class="roll__face" data-sub-on aria-hidden="true">Deliveries paused, nothing is charged</span>
              </span>
            </p>
          </div>
          <button class="switch" type="button" role="switch" aria-checked="false" aria-labelledby="vh-title" data-switch>
            <span class="switch__track" aria-hidden="true">
              <span class="switch__fill" data-fill></span>
              <span class="switch__sheen" data-sheen></span>
            </span>
            <span class="switch__knob" data-knob aria-hidden="true">
              <span class="switch__metal" data-metal></span>
            </span>
          </button>
        </header>

        <div class="away" data-away aria-hidden="true">
          <div class="away__in" data-away-in>
            <svg class="away__icon" viewBox="0 0 20 20"><rect x="3" y="4.5" width="14" height="12" rx="2.4"/><path d="M3 8.5h14M7 3v3M13 3v3"/></svg>
            <span class="away__label">Away</span>
            <span class="away__dates">Nov 10 <svg class="away__arrow" viewBox="0 0 16 10"><path d="M1 5h13M10 1.5L14 5l-4 3.5"/></svg> Dec 6</span>
            <span class="away__nights">26 days</span>
          </div>
        </div>

        <div class="list">
          <p class="list__label">Upcoming deliveries</p>
          <ul class="rows">
            <li class="row" data-row>
              <span class="row__day"><b>Nov</b><span>12</span></span>
              <span class="row__what"><span class="row__name" data-name>House Blend</span><span class="row__meta">2 bags · whole bean</span><i class="row__strike" data-strike></i></span>
              <span class="chip" data-chip><span class="chip__face" data-chip-off>Scheduled</span><span class="chip__face chip__face--on" data-chip-on><svg viewBox="0 0 12 12"><path d="M4.2 3v6M7.8 3v6"/></svg>Skipped</span></span>
            </li>
            <li class="row" data-row>
              <span class="row__day"><b>Nov</b><span>26</span></span>
              <span class="row__what"><span class="row__name" data-name>Single Origin, Huila</span><span class="row__meta">1 bag · filter grind</span><i class="row__strike" data-strike></i></span>
              <span class="chip" data-chip><span class="chip__face" data-chip-off>Scheduled</span><span class="chip__face chip__face--on" data-chip-on><svg viewBox="0 0 12 12"><path d="M4.2 3v6M7.8 3v6"/></svg>Skipped</span></span>
            </li>
            <li class="row row--back" data-row data-back>
              <span class="row__day"><b>Dec</b><span>10</span></span>
              <span class="row__what"><span class="row__name">House Blend</span><span class="row__meta">2 bags · whole bean</span></span>
              <span class="chip chip--back" data-chip><span class="chip__face" data-chip-off>Scheduled</span><span class="chip__face chip__face--on" data-chip-on><svg viewBox="0 0 12 12"><path d="M2.6 6.2l2.2 2.2 4.6-4.8"/></svg>First back</span></span>
            </li>
          </ul>
        </div>

        <footer class="foot">
          <span class="foot__label">Next charge</span>
          <span class="foot__value roll" data-charge>
            <span class="roll__face" data-charge-off><b>$38.00</b> on Nov 12</span>
            <span class="roll__face" data-charge-on aria-hidden="true"><b>$38.00</b> on Dec 10</span>
          </span>
        </footer>
      </section>
    </div>
    <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.

48 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 “Vacation hold toggle” 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 black page a dark card rises with a one pixel edge that catches the light and soft layered shadows: the settings of a coffee subscription. At the top the tile with a suitcase drawn in thin lines, the title Vacation hold, the line Pause your deliveries while you're away and the switch, a dark glass track with a brushed metal knob. Below, the next deliveries with the day in a small tile: House Blend on November 12, Single Origin, Huila on the 26th, House Blend on December 10, each labelled Scheduled, and at the bottom the next charge, 38 dollars on November 12. The finger presses: the knob widens and squashes a little, then on release it runs to the other side, stretches halfway and lands on a spring. Amber fills the track and a reflection passes over it once, a warm light comes in from the top right corner and the card's edge warms up; the suitcase lifts its handle and tips, then settles; under the title the strip of dates opens, Away from November 10 to December 6, 26 days, and the title line rolls to Deliveries paused, nothing is charged. The first two deliveries are crossed out one after the other with a thin line, turn grey and their label rolls to Skipped in amber with the pause sign; the third becomes First back with a check, and the next charge rolls to December 10. After a few seconds it turns off by itself, everything goes back with the same care, and the round starts again. The switch really works, with the mouse, the finger and the keyboard.

How it works

A real switch

It is a button with role switch and aria-checked: click, tap, Enter and space change it, and an aria-live region says out loud what happened to the deliveries. Track and knob are two layers: the glass track has an inner shadow and the amber fill that appears in opacity, the knob is an element for GSAP with the metal inside for the CSS, a conic gradient for the brushing and a radial one for the highlight.

The knob that widens and runs

On pointerdown the knob goes from 26 to 33 pixels growing toward the middle (on the right it moves left by as much as it grows), like a fingertip pressing. On release two tweens together: x toward the other side on the spring and the width with two keyframes, a little wider halfway, then 26 again. The measures come from the real track and are taken again on resize.

A real spring as the ease

Every settle uses the same function: a damped oscillator, 1 minus e to the minus d times t times the cosine of 2.5 pi times t. At t equal to 1 the cosine is zero, so the knob lands exactly in place at the end of the tween after passing it by a hair just once; SPRING changes the damping.

The light that warms the card

The edge is a layer with a one pixel padding and a mask that leaves only the frame; inside, an amber radial gradient in the top right corner has its opacity tied to the CSS variable --warm, which GSAP moves from 0 to 1. Behind the content a large radial glow comes in from the same corner and grows a little; WARMTH sets how much.

Deliveries pausing in a row

Every label and line that changes has two faces in the same grid cell: the old one rises and fades with a breath of blur, the new one comes from below on the spring. The rows start STAGGER seconds apart; the line crossing the name is as wide as the measured name and grows with scaleX from the left, and on the way back it withdraws to the right.

Values to change

NameFileDefaultWhat it changes
TRAVELscript.js0.55How many seconds the knob takes to cross the track.
SPRINGscript.js1How springy the knob and every settle are: 0.5 calm, 2 very bouncy.
STAGGERscript.js0.14How many seconds pass between one delivery and the next as they pause.
WARMTHscript.js1How much warm light pours into the card when the hold is on, 0 to 1.5.
HOLDscript.js3.6How many seconds the hold stays on during the automatic round.
AUTOscript.jstrueTurns the hold on and off by itself until someone touches the card.

Try them in the Playground

When to use it

In the settings of a subscription: coffee, food, flowers, wine, home goods, a monthly box. It fits anywhere a switch has a consequence worth showing at once: pausing deliveries, suspending a plan, taking a venue off duty. Seeing the skipped deliveries and the next charge date removes the doubt before it comes.

On phones

On the phone the card takes almost all the width and the paddings tighten with the screen height; long delivery names are shortened with an ellipsis and under 380 pixels the day count leaves the strip of dates. A tap turns it on, and the knob widens under the finger as with the mouse. The rest is the same.

With reduced motion

Nothing moves: the knob is already on the other side, the amber, the warm light and the edge fade in, the strip of dates appears open, the labels and the charge change with a fade and the line over the skipped deliveries appears without running.

Pitfalls

  • The widened knob under the finger, when on the right, grew outward and left the track: width and x are computed together (x = travel + 26 - width), so it always grows toward the middle.
  • Both faces of each label sit in the same grid cell, so the pill is as wide as the longer one and does not jump when it changes; but First back is longer than Skipped and at rest the third pill came out wider than the other two: all have a minimum width of 96 pixels and line up.
  • The warm edge made with box-shadow also coloured the shadow outside the card and looked like a glow: it is a layer of its own masked to the frame only, and the warmth is a radial gradient inside, tied to a CSS variable that GSAP animates.
  • The line crossing the name was as wide as the column and ran over the empty space after short names: the real width of the name is measured (scrollWidth, at most the column) and measured again on resize.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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