Skip to content
animorio
IT
All components

Floating action button

Menus, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.3 KBGSAP 28 KBFreeDownload the zip

The floating action button (FAB) of Quillpad, a made-up notes app, with its speed dial: an ink circle with a drawn plus in the bottom-right corner. On click the plus turns 45 degrees into a cross on a spring, the circle darkens and its shadow grows, the screen is veiled and four quick actions fan out above it, New note, Photo, Voice memo and Checklist, each in its small circle with the icon settling with a half turn and the pill label sliding in from the right. The action under the pointer lights up blue and its label widens; once one is picked, the fan closes back into the circle and a confirmation arrives at the bottom. On white, with a single blue 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>
<!--
  "Floating action 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>Floating action button</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 screen of Quillpad, a made-up notes app, with its floating action button.
         On click the plus turns into a cross and the speed dial opens upwards:
         four quick actions with their labels, the screen veiled behind them -->
    <section class="screen" data-screen aria-label="Quillpad notes">
      <header class="screen__head" aria-hidden="true">
        <span class="title">Notes</span>
        <span class="count" data-count>12 notes</span>
      </header>
      <div class="notes" aria-hidden="true">
        <article class="note"><span class="note__t">Groceries for Sunday</span><span class="l"></span><span class="l l--s"></span></article>
        <article class="note"><span class="note__t">Talk ideas, December</span><span class="l"></span><span class="l l--m"></span></article>
        <article class="note"><span class="note__t">Books to lend Mara</span><span class="l l--m"></span></article>
        <article class="note"><span class="note__t">Garden, spring plan</span><span class="l"></span><span class="l l--s"></span></article>
      </div>

      <div class="scrim" data-scrim aria-hidden="true"></div>

      <p class="toast" data-toast aria-hidden="true"><span data-toast-text>New note</span></p>

      <div class="dial" data-dial>
        <ul class="actions" data-actions role="menu" aria-label="Create" id="quick-actions">
          <li class="action" role="none">
            <button class="action__btn" type="button" role="menuitem" tabindex="-1" data-action="Checklist">
              <span class="pill" aria-hidden="true"><span class="pill__bg"></span><span class="pill__t">Checklist</span></span>
              <span class="dot">
                <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 7.2l1.4 1.4 2.6-2.8M5.5 13.2l1.4 1.4 2.6-2.8M12.5 7.6h6M12.5 13.6h6M12.5 18.4h6M6.2 18.4h2.6"/></svg>
              </span>
              <span class="sr">Checklist</span>
            </button>
          </li>
          <li class="action" role="none">
            <button class="action__btn" type="button" role="menuitem" tabindex="-1" data-action="Voice memo">
              <span class="pill" aria-hidden="true"><span class="pill__bg"></span><span class="pill__t">Voice memo</span></span>
              <span class="dot">
                <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><rect x="9.4" y="4.2" width="5.2" height="9.6" rx="2.6"/><path d="M6.6 11.4a5.4 5.4 0 0 0 10.8 0M12 16.8v3"/></svg>
              </span>
              <span class="sr">Voice memo</span>
            </button>
          </li>
          <li class="action" role="none">
            <button class="action__btn" type="button" role="menuitem" tabindex="-1" data-action="Photo">
              <span class="pill" aria-hidden="true"><span class="pill__bg"></span><span class="pill__t">Photo</span></span>
              <span class="dot">
                <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><rect x="4.4" y="6.2" width="15.2" height="11.6" rx="2.4"/><path d="M4.8 15.6l4-3.8 3.2 2.8 2.4-2 4.8 4"/><path d="M15.4 9.8h.01"/></svg>
              </span>
              <span class="sr">Photo</span>
            </button>
          </li>
          <li class="action" role="none">
            <button class="action__btn" type="button" role="menuitem" tabindex="-1" data-action="New note">
              <span class="pill" aria-hidden="true"><span class="pill__bg"></span><span class="pill__t">New note</span></span>
              <span class="dot">
                <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M7.4 4.6h6.6l3.6 3.6v11.2H7.4z"/><path d="M14 4.6v3.6h3.6M9.8 12.4h5M9.8 15.4h3.4"/></svg>
              </span>
              <span class="sr">New note</span>
            </button>
          </li>
        </ul>

        <button class="fab" type="button" data-fab aria-expanded="false" aria-controls="quick-actions" aria-label="Create">
          <span class="fab__shine" aria-hidden="true"></span>
          <svg class="plus" data-plus viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5.4v13.2M5.4 12h13.2"/></svg>
        </button>
      </div>
      <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.

38 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 “Floating action 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

The screen of Quillpad, a made-up notes app, with four faintly drawn notes and, bottom right, the black circle with its plus. Pressed, it sinks to 0.92 and comes back a pixel too far; on click the plus turns 45 degrees into a cross on a spring, the circle darkens and its shadow stretches, the screen is covered by a white veil. Four small circles fan out upwards from the button, nearest first: each rises from the button’s centre growing, its icon settles with a half turn and its pill label slides in from the right. Hovering an action turns its circle blue and widens its pill to the left; picking it squeezes the circle, the fan closes backwards, farthest first, and a confirmation arrives bottom left, for example «Voice memo · Recording». Esc, the arrow keys and a click on the veil do the same; when nobody touches it the demo plays by itself.

How it works

The actions on the same axis

The actions container sits above the button, moved right by half the difference between the big circle and the small ones: so every small circle has its centre on the same vertical as the plus.

They start from the button’s centre

Each action’s distance from the button’s centre is computed from the layout (offsetTop), never from transforms: closed, they sit there, small and transparent, and opening brings them back to y 0 on a spring, nearest first.

The plus that becomes a cross

The whole svg turns, with transformOrigin 50% 50%: on the svg itself svgOrigin would move the pivot and the cross would turn out of the circle. The plus path is drawn around the viewBox centre, 12 12.

Labels out of the cell

The pill sits left of the small circle, absolute and centred in height with top 0, bottom 0 and margin auto, no transform: GSAP slides it with x without touching the centring, and the label can never widen the circle.

The confirmation

Once an action is picked, the closing timeline has an onComplete that brings in the confirmation pill bottom left, level with the button, with a back.out, and sends it away after a second and a half.

Values to change

NameFileDefaultWhat it changes
OPEN_TIMEscript.js0.55Seconds the actions take to fan out of the button.
STAGGERscript.js0.06Seconds between one action and the next as they open.
TURNscript.js45Degrees the plus turns to become the cross.
SPRINGscript.js0.6How springy the button and the actions are (lower = more bounce).
VEILscript.js1How much the screen is veiled while the dial is open (0 = not at all).
AUTO_PAUSEscript.js6Seconds of quiet before the demo plays by itself again.

Try them in the Playground

When to use it

In apps and mobile sites with one main action and a few variants: create a note, a photo, a memo; the button always stays in the corner and opens the shortcuts without leaving the screen.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the fan fits the screen even in the short box. A tap works like a click; while closed the actions are measured again if the window changes.

With reduced motion

No springs, turns or flights: the plus becomes a cross at once, the actions and the veil fade in and out, the confirmation arrives without moving.

Pitfalls

  • If the whole svg turns it needs transformOrigin 50% 50%, never svgOrigin: on the svg, which on the page is an HTML element, svgOrigin moves the pivot and the cross circles around instead of turning on itself.
  • The actions’ distance from the button must come from offsetTop: measured with getBoundingClientRect on an action already scaled and moved it would be wrong.
  • The label must not be centred with translateY in the CSS: GSAP, animating x, rewrites the transform and would erase it. It is centred with top 0, bottom 0 and margin auto.

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 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