Skip to content
animorio
IT
All components

Save draft button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.2 KBGSAP 28 KBFreeDownload the zip

The «Save draft» button at the bottom of a note in Quillmark, a made-up editor: an ink pill with a line-drawn cloud. Press it (or Cmd/Ctrl+S) and a thin line works inside the pill, the cloud redraws itself, the arrow rises and turns into a green tick, «Saved» rolls in over the label and below «Draft saved · 11:43» rolls only the digits of the time that change. Then you keep writing, the line says «Unsaved changes» and the pill goes back to «Save draft», always widening and narrowing on a spring. On white, with a single green accent.

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>
<!--
  "Save draft button" 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>Save draft button</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- a small note in a made-up editor and its Save draft pill.
         Press it (or Cmd/Ctrl+S): a thin line works inside the pill, the cloud draws itself,
         the arrow rises and turns into a tick, «Saved» rolls in and the time of the save rolls below -->
    <section class="editor" data-editor aria-label="Draft editor">
      <header class="editor__head">
        <span class="app">Quillmark</span>
        <span class="path">Drafts / <strong>Spring launch notes</strong></span>
      </header>

      <div class="page">
        <h1 class="page__title">Spring launch notes</h1>
        <p class="page__text">The first batch ships on the ninth. Keep the landing page short: one line, one photo, and the price where people look first.<span class="typed" data-typed></span><span class="caret" data-caret aria-hidden="true"></span></p>
      </div>

      <footer class="bar">
        <p class="status" data-status aria-hidden="true">
          <span class="status__row" data-row="saved">Draft saved <span class="sep">·</span> <span class="time" data-time></span></span>
          <span class="status__row" data-row="dirty">Unsaved changes</span>
        </p>

        <button class="pill" type="button" data-pill aria-keyshortcuts="Control+S Meta+S">
          <span class="pill__face" data-face>
            <svg class="cloud" viewBox="0 0 24 24" aria-hidden="true">
              <path class="cloud__shape" data-cloud pathLength="1" d="M7.2 18.5h9.6a3.9 3.9 0 0 0 .5-7.77A5.4 5.4 0 0 0 6.9 9.4a4.6 4.6 0 0 0 .3 9.1z"/>
              <g data-arrow><path class="cloud__arrow" d="M12 16.4v-5.6M9.7 12.9l2.3-2.3 2.3 2.3"/></g>
              <path class="cloud__tick" data-tick pathLength="1" d="M9.3 13.4l1.9 1.9 3.6-3.9"/>
            </svg>
            <span class="pill__words" data-words>
              <span class="word" data-word="save">Save draft</span>
              <span class="word" data-word="saving">Saving</span>
              <span class="word" data-word="saved">Saved</span>
            </span>
          </span>
          <span class="pill__work" data-work aria-hidden="true"><span data-run></span></span>
        </button>
      </footer>
      <p class="sr" aria-live="polite" data-live></p>
    </section>
  </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.

26 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 “Save draft button” 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

A Quillmark note, «Spring launch notes», with the title in a serif, two lines of text and the caret blinking; at the bottom the line «Unsaved changes» and the black «Save draft» pill with the cloud. Hover it and the pill lights up while its content rises by a pixel; press it and it sinks to 0.96 and comes back with a small bounce. On click the label turns into «Saving», the pill narrows on a spring, a thin line runs inside, the cloud redraws and the arrow keeps rising; after a little over a second the arrow leaves, the green tick draws itself, «Saved» arrives and below «Draft saved · 11:43» with the digits rolling. A few seconds later a new sentence is typed, the line goes back to «Unsaved changes», the tick empties, the arrow returns and the pill widens again into «Save draft».

How it works

Three states

The state is a single word, dirty, working or saved: the click or Cmd/Ctrl+S save, typing again goes back to dirty.

The pill follows the word

The three labels sit on top of each other out of the flow, inside a box as wide as the visible word: when the word changes GSAP springs the box width to the new measure, and the pill widens or narrows with it.

The work

No spinner: a thin line runs along the bottom of the pill, repeating, while the cloud redraws with stroke-dashoffset and the arrow rises; a GSAP delayedCall ends the save.

The rolling time

Every character of the time is a cell with its overflow hidden: only the digits that differ change, the new one rises from below with back.out and the old one leaves at the top, 0.05 s apart.

Typing again

A new sentence appears letter by letter in the paragraph, the caret stops blinking while typing and the pill goes back to «Save draft».

Values to change

NameFileDefaultWhat it changes
WORKscript.js1.2Seconds the line works inside the pill before the save.
PRESSscript.js0.96Scale of the pill while pressed.
SPRINGscript.js0.55How springy the pill is when it changes width (lower means more bounce).
SAVED_HOLDscript.js2.6Seconds «Saved» stays before you type again.
START_TIMEscript.js11:42The starting time: it moves on by a minute at every save.
AUTO_PAUSEscript.js6Seconds of quiet before the demo plays by itself again.

Try them in the Playground

When to use it

In text editors, CMSs, notes and long forms: wherever the writer wants to save by hand and see right away when they last did it.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the note fits the phone box. A tap works like a click; the label width is measured again if the window changes.

With reduced motion

No springs or movement: the labels change at once, the working line stays still, the tick appears already drawn, the time changes without rolling and the new sentence appears whole.

Pitfalls

  • The hidden labels are out of the flow (position: absolute) in a box with a measured width: a hidden nowrap label in the flow would widen the pill and push the content off centre.
  • The width is measured after document.fonts.ready and on every resize: before the font arrives the word is wider or narrower.
  • The measure is divided by the pill’s scale, otherwise pressing the pill makes the new word come out narrower.
  • With stroke-dashoffset and pathLength 1 autoRound has to be off, or the tick and the cloud pop in at once.
  • Cmd/Ctrl+S has to be stopped with preventDefault, or the browser opens its save page dialog.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.

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

Testing

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