Skip to content
animorio
IT
All components

Unsaved changes bar

Notifications, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

The unsaved changes bar of a settings page, in the style of real product interface pieces: as soon as you change a field a dark bar rises from the bottom on a spring, with Discard and Save changes, and the count of changes rolls. If you try to leave, the bar shakes and asks you to choose first; Save works for a moment, the bar turns green with «Saved» and a check and slides away; Discard puts every value back with a small flash.

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>
<!--
  "Unsaved changes bar" 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 unsaved changes bar that rises from the bottom</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" data-stage>
    <!-- the settings page of a small app: change a field and a dark bar rises from the bottom with Discard and
         Save changes; the count of changes rolls, trying to leave makes the bar shake, Save turns it green and it
         slides away, Discard puts every field back with a small flash -->
    <section class="screen" data-screen aria-label="Profile settings">
      <header class="top">
        <a class="back" href="#" data-back aria-label="Back to workspace">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14.5 6 8.5 12l6 6"/></svg>
          <span>Workspace</span>
        </a>
        <span class="brand"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 5h6v6H5zM13 13h6v6h-6zM13 5l6 6M5 19l6-6"/></svg><span data-app>Ketterly</span></span>
      </header>

      <div class="head">
        <h1 class="h1">Profile</h1>
        <p class="lead">How your name and time show up to the team.</p>
      </div>

      <form class="form" data-form autocomplete="off" onsubmit="return false">
        <label class="field" data-field="name">
          <span class="field__label">Display name</span>
          <span class="field__box"><input class="field__input" type="text" value="Mira Holt" data-input="name" spellcheck="false"></span>
        </label>

        <label class="field" data-field="email">
          <span class="field__label">Email</span>
          <span class="field__box"><input class="field__input" type="email" value="mira@ketterly.app" data-input="email" spellcheck="false"></span>
        </label>

        <div class="field" data-field="zone">
          <span class="field__label">Time zone</span>
          <button class="field__box select" type="button" data-select aria-haspopup="listbox" aria-expanded="false">
            <span class="select__val"><span class="swap" data-zone><span>GMT+1 · Berlin</span></span></span>
            <svg class="chev" viewBox="0 0 24 24" aria-hidden="true"><path d="m7 10 5 5 5-5"/></svg>
          </button>
          <ul class="menu" role="listbox" data-menu>
            <li role="option" data-opt="GMT+0 · London">GMT+0 · London</li>
            <li role="option" data-opt="GMT+1 · Berlin">GMT+1 · Berlin</li>
            <li role="option" data-opt="GMT−5 · New York">GMT−5 · New York</li>
          </ul>
        </div>

        <div class="field field--row" data-field="digest">
          <span class="field__txt"><span class="field__label">Weekly digest</span><span class="field__hint">A short email every Monday</span></span>
          <button class="toggle" type="button" role="switch" aria-checked="true" data-toggle><span class="toggle__knob"></span></button>
        </div>
      </form>

      <div class="bar" role="status" aria-live="polite" data-bar>
        <span class="bar__txt">
          <span class="bar__title"><span class="swap" data-title><span>Unsaved changes</span></span></span>
          <span class="bar__sub"><span class="swap" data-sub><span><span class="num" data-num><span>1</span></span> <span data-word>change</span></span></span></span>
        </span>
        <span class="bar__actions" data-actions>
          <button class="discard" type="button" data-discard>Discard</button>
          <button class="save" type="button" data-save>
            <svg class="spin" viewBox="0 0 24 24" aria-hidden="true" data-spin><circle cx="12" cy="12" r="8"/></svg>
            <span class="save__label"><span class="swap" data-save-label><span>Save changes</span></span></span>
          </button>
        </span>
        <svg class="done" viewBox="0 0 24 24" aria-hidden="true" data-done><path d="M6 12.5l4 4 8-9"/></svg>
      </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.

34 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 “Unsaved changes bar” 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 very light grey background sits the white settings window of Ketterly, an invented app: at the top the arrow back to the workspace and the mark, below «Profile» and four items, the display name, the email, the time zone in a dropdown and the weekly digest toggle. A drawn pointer goes into the name field and changes it letter by letter: the field takes a soft purple edge, and a dark bar rises from the bottom on a spring, «Unsaved changes» and «1 change», with Discard and Save changes arriving a beat later. With the toggle off, the digit rolls to 2 and the bar swells slightly. The pointer tries to go back: the bar shakes, Save swells and the title rolls to «Save or discard?», then back. Pressed, Save says «Saving» with a spinner, then the bar turns green, a check draws itself, the title says «Saved» and the bar slides away; the purple edges disappear. In the next round the pointer opens the time zone and picks London: the bar returns with one change, and Discard puts Berlin back with the word rolling the other way and a purple flash on the field, then the bar slides down. It all really works: you type in the fields, pick a zone, press, with mouse, touch and keyboard.

How it works

What changed

The script keeps two copies of the values, the saved ones and the form’s, and compares them on every input: the number of different items is the bar’s count, and every different field gets the is-edited class, which gives it an accent edge with a faint halo, never a dot.

The bar that rises

The bar is absolute at the bottom of the window: it starts at yPercent 170 and rises to 0 with back.out(1.6) while widening from 0.9 to 1; the two buttons arrive a moment later from six pixels lower, one after the other. With no changes it goes down with back.in.

The rolling words

Every changing text sits inside a mask: the old one rises and fades in 0.22 seconds, the new one comes from below 0.16 seconds later with back.out, so two texts are never readable together. If only the number changes, only the digit rolls.

The shake

With changes open, the back link does not leave: the bar runs x keyframes (-8, 7, -5, 3, -1, 0), Save swells to 1.08 and back, and for a second and a half the title says «Save or discard?».

Saved or discarded

Save spins a spinner for a moment, then the form values become the saved ones, the bar turns green in a single colour tween, the check draws itself with strokeDashoffset and the bar slides down. Discard puts the values back, lights an accent veil on the field that fades in half a second and sends the bar down.

Values to change

NameFileDefaultWhat it changes
APPscript.jsKetterlyThe name of the invented app, written at the top right.
ACCENTscript.js#5b5bf0The colour of the edited fields and of the Discard flash.
SAVEDscript.js#1f9d55The colour of the bar when it says Saved.
RISEscript.js0.65The seconds the bar takes to rise from the bottom on its spring.
SAVE_TIMEscript.js0.9The seconds Save stays on «Saving» before saying Saved.
HOLDscript.js1.3The seconds «Saved» stays before sliding away.
TYPEscript.js0.085The seconds between letters when the pointer types.

Try them in the Playground

When to use it

For an app’s settings or profile page, an admin panel, a product or post editor: anywhere changes are not saved automatically and the reminder has to be gentle, without a blocking dialog.

On phones

The window takes the width of the box and a height in vh, fields and gaps tighten with the height, the bar stays as wide as the window minus the margins and below 380 pixels the buttons get narrower. A tap does what a click does.

With reduced motion

No springs, shakes or rolls: the bar fades in and out, texts change in place, the toggle snaps without a bounce and there is no Discard flash. The drawn pointer stays hidden.

Pitfalls

  • The two texts of a change never fade over each other: the old one leaves first and the new one comes in with a short delay, inside a one-line mask.
  • The edited fields’ edge is an rgba computed by the script, not a color-mix: color-mix does not work when the videos are rendered.
  • While the bar saves or discards, inputs do not call it back: a busy flag keeps the bar from rising again halfway down.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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