
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteThe 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.
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.
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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
APP | script.js | Inkwell Mail | The email app’s name at the top right. |
NAME | script.js | Ada Morrow | The account name next to the Away label. |
FROM | script.js | Nov 3 | The first day out of office. |
UNTIL | script.js | Nov 10 | The last day out of office. |
MESSAGE | script.js | Hi, 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_SPEED | script.js | 38 | How many letters per second the reply writes. |
SPRING | script.js | 0.75 | How much the opening panel bounces: lower is springier. |
ACCENT | script.js | #f5b544 | The colour of the sun, the label and the switch when on. |
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.
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.
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.
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.
Tested on 29 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.