Skip to content
animorio
IT
All components

Session timeout dialog

Dialogs, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.5 KBGSAP 28 KBFreeDownload the zip

The notice that appears when a session is about to expire: the seconds roll inside a draining ring that turns red for the last ones and beats at every second. “Stay signed in” refills it with a bounce; at zero the ring makes way for a padlock that closes and the card asks to sign in again.

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>
<!--
  "Session timeout dialog" 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>Session timeout dialog</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 notice of a session about to expire: the seconds roll inside a draining ring,
         Stay signed in refills it, and at zero the card locks itself and asks to sign in again -->
    <section class="st" data-st role="alertdialog" aria-labelledby="st-title" aria-describedby="st-text">
      <div class="st__dial" data-dial aria-hidden="true">
        <svg class="st__ring" viewBox="0 0 64 64">
          <circle class="st__track" cx="32" cy="32" r="27"></circle>
          <circle class="st__arc" data-arc cx="32" cy="32" r="27" pathLength="1" transform="rotate(-90 32 32)"></circle>
        </svg>
        <span class="st__num"><span data-num>6</span></span>
        <svg class="st__lock" data-lock viewBox="0 0 28 28">
          <path data-shackle d="M9.500 13V9.800a4.500 4.500 0 0 1 9 0V13"></path>
          <rect x="6.500" y="13" width="15" height="10.500" rx="3"></rect>
          <path d="M14 17.300v2.200"></path>
        </svg>
      </div>
      <h1 class="st__title" id="st-title"><span data-title>Still there?</span></h1>
      <p class="st__text" id="st-text"><span data-text>We’ll sign you out soon to keep your account safe.</span></p>
      <div class="st__keys">
        <button class="st__btn" type="button" data-stay><span class="st__btntext"><span data-staylabel>Stay signed in</span></span></button>
        <button class="st__link" type="button" data-out>Log out</button>
      </div>
      <span class="st__say" data-say aria-live="assertive"></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

16 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Session timeout dialog” 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 white, a light card with a soft shadow. At the top a disc tinted orange with a ring and the number of seconds inside; below, “Still there?”, a line explaining the sign-out, the dark “Stay signed in” button and, smaller, “Log out”. The number rolls every second and the ring drains smoothly. In the last three seconds disc, ring and number turn red and the disc gives a small beat at every second. With “Stay signed in” the button gives, the ring fills again, the disc bounces, the colour returns to orange and the title rolls into “Session extended” for a moment. Let the count reach zero and the ring vanishes, the disc turns grey, a padlock comes in on a spring and its shackle drops shut; title and text roll into “Signed out” and “Sign in again to pick up where you left off”, the button becomes “Sign in again” and “Log out” fades. Signing in opens the padlock and the count starts again.

How it works

The seconds are one number

A linear tween takes a number from SECONDS to zero; on every frame one function derives the ring’s arc and the whole second to show.

The last seconds

Below WARN a class changes the colour of disc, ring and number through a CSS variable, and at every second that ticks the disc gives a beat.

Staying

The count’s tween is stopped, another takes the number back to the top in six tenths, the disc bounces on a spring and the count starts again.

Zero

At the end of the tween the card goes to its locked state: the padlock scales in, the shackle drops with a bounce and the words roll.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#f2872eThe colour of the ring and of the seconds while there is time.
LOWscript.js#ec4136The colour of the last seconds.
SECONDSscript.js6How many seconds the count starts from before signing out.
WARNscript.js3From how many seconds the ring changes colour and beats every second.
SPRINGscript.js1How much the refilling ring, the padlock and the buttons bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer stays in at the last moment, then lets it expire and signs in again.

Try them in the Playground

When to use it

In apps with sensitive data: banking, health, admin panels, work portals, checkouts. It appears after a spell of inactivity, before closing the session, and also suits a cart or a booking held for a few minutes.

On phones

The same card, 284 pixels wide at most: the button is 44 pixels tall, the text wraps into two balanced lines and everything fits a short screen.

With reduced motion

The count still goes on, because it is the data: the number changes without rolling and the ring steps down a second at a time. No bounces: the padlock and the words appear in place. The demo does not click by itself.

Pitfalls

  • The count is short here so it can be seen: in a real app the notice appears a minute or two before expiry, and the expiry is decided by the server.
  • In a real app “Stay signed in” calls the server to renew the session: the ring only refills when it answers.
  • The card has role=alertdialog; the seconds are not read one by one: a hidden line warns when WARN seconds are left and when you are signed out.
  • Accessibility guidelines require that people can extend the time: the button to stay must never be removed or hidden.
  • At zero the ring’s arc has to be hidden: with round caps a dot would stay at the top.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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