Skip to content
animorio
IT
All components

Out of office toggle

Toggles, Hover, TextGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

The settings of an email app, on black, in the style of product interface pieces: switching Out of office on opens the auto-reply under the row on a spring, with the dates and a message that writes itself, and an Away label with a small drawn sun appears next to the account name. Switching it off folds content and height away together.

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>
<!--
  "Out of office 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 Out of office toggle that writes its own auto-reply</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 mail settings of an invented app: switching Out of office on opens the auto-reply under it on a spring,
         with the dates and a message that writes itself, and puts an Away label with a small drawn sun next to the
         account name; switching it off folds content and height away together -->
    <section class="card" data-card aria-labelledby="oo-label">
      <header class="acc">
        <span class="acc__avatar" aria-hidden="true">AM</span>
        <span class="acc__text">
          <span class="acc__line">
            <span class="acc__name" data-name>Ada Morrow</span>
            <span class="away" data-away aria-hidden="true">
              <svg class="away__sun" viewBox="0 0 16 16">
                <g class="away__rays" data-rays>
                  <path d="M8 1.2v1.6M8 13.2v1.6M1.2 8h1.6M13.2 8h1.6M3.2 3.2l1.1 1.1M11.7 11.7l1.1 1.1M3.2 12.8l1.1-1.1M11.7 4.3l1.1-1.1"></path>
                </g>
                <circle class="away__core" data-core cx="8" cy="8" r="2.7"></circle>
              </svg>
              <span>Away</span>
            </span>
          </span>
          <span class="acc__mail" data-mail>ada@inkwell.studio</span>
        </span>
        <span class="acc__app" data-app>Inkwell Mail</span>
      </header>

      <div class="row">
        <span class="ico" aria-hidden="true">
          <svg viewBox="0 0 24 24">
            <defs><clipPath id="oo-sky"><rect x="0" y="0" width="24" height="15.2"></rect></clipPath></defs>
            <g clip-path="url(#oo-sky)">
              <g class="ico__sun" data-icosun>
                <circle cx="12" cy="15" r="4"></circle>
                <path d="M12 7.6v1.6M6.6 10.1l1.1 1.1M17.4 10.1l-1.1 1.1"></path>
              </g>
            </g>
            <path class="ico__line" d="M3.5 15.2h17"></path>
            <path class="ico__line ico__line--soft" d="M6.5 18.6h11"></path>
          </svg>
        </span>
        <span class="row__text">
          <span class="row__name" id="oo-label">Out of office</span>
          <span class="row__hint"><span data-hint>Auto-reply is off</span></span>
        </span>
        <button class="sw" type="button" role="switch" aria-checked="false" aria-labelledby="oo-label" aria-controls="oo-panel" data-switch>
          <span class="sw__knob" data-knob></span>
        </button>
      </div>

      <div class="panel" id="oo-panel" data-panel>
        <div class="panel__in" data-panelin>
          <div class="dates">
            <span class="date" data-date>
              <span class="date__label">From</span>
              <span class="date__value">
                <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3.2" width="12" height="10.6" rx="2.2"></rect><path d="M2 6.6h12M5.4 1.8v2.6M10.6 1.8v2.6"></path></svg>
                <span data-from>Nov 3</span>
              </span>
            </span>
            <svg class="dates__to" viewBox="0 0 20 10" aria-hidden="true"><path d="M1.5 5h16M13.5 1.6 17.4 5l-3.9 3.4"></path></svg>
            <span class="date" data-date>
              <span class="date__label">Until</span>
              <span class="date__value">
                <svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3.2" width="12" height="10.6" rx="2.2"></rect><path d="M2 6.6h12M5.4 1.8v2.6M10.6 1.8v2.6"></path></svg>
                <span data-until>Nov 10</span>
              </span>
            </span>
          </div>
          <div class="msg" data-msg>
            <span class="msg__label">Auto-reply</span>
            <p class="msg__text"><span data-text></span><span class="caret" data-caret aria-hidden="true"></span></p>
          </div>
          <p class="foot"><span data-foot>Sent once to each sender</span></p>
        </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>

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.

30 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 “Out of office 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 background there is the settings card of an invented email app, Inkwell Mail: Ada Morrow’s account with the initials in an amber circle, and under it the Out of office row with its icon, a horizon with a hidden sun, and the switch. Switching on, the knob stretches and slides on a spring and the track turns amber; in the icon the sun rises over the horizon, the line under the title rolls to «Replying until Nov 10» and the Away label appears next to the name, with a small sun drawing its rays and then turning slowly. Meanwhile the auto-reply panel opens under the row on a spring: the From and Until dates with the arrow drawing itself between them, and the message box where the reply writes itself letter by letter behind a thin amber caret; once done, the line at the bottom says «Saved, sent once to each sender». Switching off, the sun sets, the label shrinks away and the panel folds up with its content, together. A drawn pointer switches it on, looks at the return date and switches it off; it also works with the mouse, touch and the keyboard.

How it works

The panel on a spring

The panel has zero height and hidden overflow: switching on, the script measures the content height and takes it there with elastic.out, then leaves it on auto, so the message can grow and resizing the window does not break it. The parts inside rise one after another with a small back.out.

Content and size together

Switching off, the height goes to zero with power3.inOut in the same time as the parts fade out upwards, from the last to the first: nothing is left empty while it closes, and the text is cleared only once the panel is shut.

The reply that writes itself

A GSAP tween takes a counter from zero to the message length, at TYPE_SPEED letters per second, and at each step the text becomes the message cut up to there; the caret is a thin span, steady while typing and blinking afterwards.

The rising sun and its rays

In the icon the sun sits inside a clipPath that ends at the horizon: moving it up is enough to make it rise. In the label the rays are strokes with a strokeDasharray that draw one after another, then the group turns slowly around its centre with svgOrigin.

Values to change

NameFileDefaultWhat it changes
APPscript.jsInkwell MailThe email app’s name at the top right.
NAMEscript.jsAda MorrowThe account name next to the Away label.
FROMscript.jsNov 3The first day out of office.
UNTILscript.jsNov 10The last day out of office.
MESSAGEscript.jsHi, I’m away until Nov 10 with little access to email. For anything urgent, Leo can help at leo@inkwell.studio.The auto-reply that writes itself.
TYPE_SPEEDscript.js38How many letters per second the reply writes.
SPRINGscript.js0.75How much the opening panel bounces: lower is springier.
ACCENTscript.js#f5b544The colour of the sun, the label and the switch when on.

Try them in the Playground

When to use it

For the settings of an email, chat or team app, and for any switch that opens more options under it when turned on: absences, holidays, auto-replies, account statuses.

On phones

The card takes the width with a margin; the gaps are sized on the height too with clamp and vmin, and below 470 pixels of height the app name and the bottom line hide and the message gets smaller, so the open panel fits in the box. Touch works like a click.

With reduced motion

No springs or rolls: the knob goes to its place, the panel and the label fade in and out, the sun has already risen and the message is already written. The fake pointer does not start.

Pitfalls

  • A height animated in pixels stays fixed: at the end of the opening it goes back to auto, otherwise a longer message or a narrower window cuts the text.
  • When closing, the typing and the caret blink stop first, otherwise the tween keeps writing inside a panel that is already shut.
  • GSAP writes its own inline transform: the knob has no transform in the CSS, it is placed with left and top and GSAP only moves its x and width.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 29 October 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