Skip to content
animorio
IT
All components

Retry button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.3 KBGSAP 28 KBFreeDownload the zip

An interface button in the style of product micro-interactions, Press gesture, on very light grey: in a failed sync row, «Retry» with a circular arrow. Pressing it rewinds the arrow backwards for a turn and a half as it slows, the black pill shrinks into a white circle with a thin ring that loads like a real network; the first time it stops, turns red and the pill comes back with a small shake, the second time it closes, turns green and writes «Synced» with a drawn check.

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>
<!--
  "Retry 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>The Retry button that rewinds</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>
    <!-- a failed sync row with its Retry button: the arrow rewinds, the pill shrinks into a ring that loads,
         then it either fails again with a small shake or turns green with a drawn check -->
    <section class="sync" data-card aria-label="Sync status">
      <div class="sync__files" aria-hidden="true">
        <svg viewBox="0 0 32 32">
          <path class="sheet sheet--back" d="M11 4.5h9.5l5 5V24a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V6.5a2 2 0 0 1 2-2Z"></path>
          <path class="sheet" d="M7 8.5h9.5l5 5V28a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V10.5a2 2 0 0 1 2-2Z"></path>
          <path class="fold" d="M16.5 8.5v5h5"></path>
          <path class="lines" d="M9 19h8M9 22.5h5.5"></path>
        </svg>
      </div>
      <div class="sync__text">
        <p class="sync__title"><span class="roll" data-title><span class="roll__in">Sync failed</span></span></p>
        <p class="sync__sub" aria-live="polite"><span class="roll" data-sub><span class="roll__in">2 files couldn’t upload</span></span></p>
      </div>
      <button class="retry" type="button" data-retry aria-label="Retry sync">
        <span class="retry__face" data-face></span>
        <svg class="retry__ring" data-ring viewBox="0 0 44 44" aria-hidden="true">
          <circle class="retry__track" cx="22" cy="22" r="19.5"></circle>
          <circle class="retry__arc" data-arc cx="22" cy="22" r="19.5" pathLength="1"></circle>
        </svg>
        <span class="retry__icon" data-icon aria-hidden="true">
          <svg viewBox="0 0 20 20"><path d="M4.2 7.4A6.2 6.2 0 1 1 3.8 12"></path><path d="M3.6 3.4v4.4H8"></path></svg>
        </span>
        <svg class="retry__check" data-check viewBox="0 0 20 20" aria-hidden="true"><path d="M5 10.4 8.4 13.6 15 6.6" pathLength="1"></path></svg>
        <span class="retry__labels" data-labels>
          <span class="retry__label" data-label-retry>Retry</span>
          <span class="retry__label" data-label-done>Synced</span>
        </span>
      </button>
    </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.

19 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 “Retry 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

On a very light grey background sits a small white row, like those of a file app: two sheets drawn in a thin line, «Sync failed» and below it, in grey, «2 files couldn’t upload», and on the right the black «Retry» pill with a circular arrow. On hover the arrow turns back a few degrees. Pressing squashes the pill and tightens its shadow; the arrow rewinds backwards for a turn and a half and slows like a spring, the label slides away and the pill shrinks into a white circle, with the black arrow in the middle still turning slowly. Around the circle a thin ring fills like a real network: fast, slower, a pause, the last stretch; meanwhile the title becomes «Syncing…» and the line below says «Uploading 1 of 2», with the number rolling. The first time the ring stops at three quarters and turns red, the circle goes back to a black pill with «Retry», shakes a few pixels left and right and below it reads «Failed again · 2 files». The second time the ring closes, the circle widens into a green pill, the done mark draws itself and «Synced» arrives, with a one-pixel settle; the title becomes «Up to date». After a pause the button comes back. A drawn pointer does a failure and a success by itself, and the button really works with mouse, finger and keyboard.

How it works

A pill, a circle, a pill

The button has a pixel width that GSAP takes from the width of «Retry» to 40, the circle, and then to the width of «Synced»: both widths are read from the real labels, so any text fits. The face is a separate element that changes colour and shadow, and squashes on press without touching the width.

The arrow that rewinds

The icon is a span rotated by GSAP by minus 540 degrees in 1.1 seconds with power4.out, which starts with a snap and slows like a spring; then a slow endless tween keeps it turning while it loads. The small hover turn sits on the svg inside, in CSS, so GSAP’s transform does not wipe it.

A ring that behaves like the network

The arc is an SVG circle with pathLength 1: its strokeDashoffset goes from 1 to 0 following an object through four stretches with different curves, fast, slower, almost still, the last one. The same value rolls the number of the file being uploaded.

Failing and succeeding

Every other attempt fails: the arc stops at 0.71 and turns red, the pill comes back and a six-step keyframe shakes it by a few fading pixels. When it works, the circle widens in green, the check draws itself with its dashoffset and a one-pixel settle sets it down.

Values to change

NameFileDefaultWhat it changes
LOAD_TIMEscript.js1.8The seconds the ring loads before it succeeds or fails.
SPINSscript.js1.5How many turns the arrow rewinds when pressed.
SHAKEscript.js5How many pixels the pill shakes when it fails again.
HOLDscript.js2.2The seconds Synced stays before the button comes back.
FILESscript.js2How many files failed to upload.
OK_COLORscript.js#16a34aThe colour of the pill when it worked.

Try them in the Playground

When to use it

For any action that can fail and be tried again: a sync, a file upload, a declined payment, a lost connection, an export. It says that it is retrying, how far it is and how it went, in the same place as the button.

On phones

The row takes the full width minus the margins and the button stays 40 pixels tall, easy for a finger; under 380 pixels the text tightens a little. A tap does what a click does.

With reduced motion

No spins and no shake: the pill goes to the circle and back without stretching, the ring fills, the text changes with a fade and the drawn pointer stays hidden.

Pitfalls

  • The hover turn and the loading spin on the same element wiped each other out: GSAP’s sits on the span, the CSS one on the svg inside.
  • With an auto width the pill cannot be animated: the widths of «Retry» and «Synced» are measured on the labels, which sit in absolute position, and measured again on resize.
  • A rolling line whose new text was longer than the old one got clipped: while it changes, the container takes the width of the longer of the two.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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