Skip to content
animorio
IT
All components

Share link button

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

The Share button of a document in a made-up docs app, black on black with one gesture: pressed, the pill widens on a spring and shows the short link, who can open it and Copy. Tap the globe and the link turns into “Only people invited” as the lock snaps shut; Copy runs a pass of light along the link, turns into Copied with a check, the pill gives one beat and then folds back into the button.

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>
<!--
  "Share link 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 Share button with the link that copies inside the pill</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 Share button of a document in a made-up docs app: pressed, it widens into a long pill with the short link,
         who can open it (the globe or the lock, tap it to switch) and Copy; copying sends a pass of light along the
         link, Copy turns into Copied with a check, the pill gives one beat and then folds back into the button -->
    <div class="wrap" data-wrap>
      <div class="pill" data-pill>
        <span class="pill__floor" aria-hidden="true"></span>
        <span class="pill__halo" data-halo aria-hidden="true"></span>
        <div class="pill__clip">
          <span class="pill__grain" aria-hidden="true"></span>
          <span class="pill__sheen" data-sheen aria-hidden="true"></span>

          <button class="share" type="button" data-share aria-expanded="false" aria-controls="share-panel">
            <span class="share__in" data-sharein>
              <svg class="share__ic" data-shareic viewBox="0 0 24 24" aria-hidden="true">
                <path d="M8.2 9.6H7a2.4 2.4 0 0 0-2.4 2.4v6A2.4 2.4 0 0 0 7 20.4h10a2.4 2.4 0 0 0 2.4-2.4v-6A2.4 2.4 0 0 0 17 9.6h-1.2"></path>
                <path class="share__arrow" data-sharearrow d="M12 14.4V3.8M8.4 7.2 12 3.6l3.6 3.6"></path>
              </svg>
              <span class="share__word" data-shareword>Share</span>
            </span>
          </button>

          <div class="panel" id="share-panel" data-panel role="group" aria-label="Share this document">
            <button class="acc" type="button" data-acc aria-pressed="false" aria-label="Who can open the link: anyone with the link. Tap to limit it to invited people">
              <svg class="acc__ic" viewBox="0 0 24 24" aria-hidden="true">
                <g class="globe" data-globe>
                  <circle cx="12" cy="12" r="7.6"></circle>
                  <ellipse class="globe__mer" data-mer cx="12" cy="12" rx="3.4" ry="7.6"></ellipse>
                  <path d="M4.6 12h14.8"></path>
                  <path class="globe__lat" d="M5.9 8.2h12.2M5.9 15.8h12.2"></path>
                </g>
                <g class="lock" data-lock>
                  <path class="lock__shackle" data-shackle d="M8.6 11V8.6a3.4 3.4 0 0 1 6.8 0V11"></path>
                  <rect class="lock__body" data-lockbody x="6.2" y="10.8" width="11.6" height="8.8" rx="2.6"></rect>
                  <path class="lock__hole" d="M12 14.2v2"></path>
                </g>
              </svg>
            </button>

            <div class="link">
              <span class="link__url" data-url>
                <span class="link__text"><span class="link__host" data-host>brindle.so/d/</span><span class="link__slug" data-slug>q1-brief</span></span>
                <span class="link__glint" data-glint aria-hidden="true"></span>
              </span>
              <span class="link__who"><span class="link__whoin" data-who>Anyone with the link</span></span>
            </div>

            <button class="copy" type="button" data-copy aria-label="Copy link">
              <span class="copy__ic" aria-hidden="true">
                <svg class="copy__chain" data-chain viewBox="0 0 24 24">
                  <path d="M10.4 13.6a3.6 3.6 0 0 0 5.1 0l2.9-2.9a3.6 3.6 0 0 0-5.1-5.1l-1.1 1.1"></path>
                  <path d="M13.6 10.4a3.6 3.6 0 0 0-5.1 0l-2.9 2.9a3.6 3.6 0 0 0 5.1 5.1l1.1-1.1"></path>
                </svg>
                <svg class="copy__check" viewBox="0 0 24 24">
                  <path data-check d="M5.6 12.6 10 17l8.4-9.4"></path>
                </svg>
              </span>
              <span class="copy__words"><span class="copy__col" data-copycol><span>Copy</span><span>Copied</span></span></span>
            </button>
          </div>
        </div>
        <span class="pill__edge" data-edge aria-hidden="true"></span>
      </div>
      <p class="sr" data-live aria-live="polite"></p>
    </div>

    <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 “Share link 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 black background there is just a dark pill sixty pixels tall, its body fading from charcoal to near black, a very fine grain, a thread of light along its top edge and a faint blue reflection on the floor below: inside, the share icon drawn in line and the word Share. On hover the pill lifts by a pixel, the thread on the edge lights up right where the pointer is and follows it, and the word widens on the typeface’s wdth axis. Pressed, it squeezes and comes back on a spring. The icon’s arrow gives a jerk upwards, icon and word leave at the top and the pill widens from the middle on an elastic spring to almost four hundred pixels: on the left a blue circle with a globe comes in turning, in the middle the document’s short link, brindle.so/d/q1-brief, uncovers itself from the left with the host in grey and the document’s name in white, “Anyone with the link” below it, and on the right the white Copy button arrives with a bounce and its chain icon. Tap the globe and its meridian narrows as if it were spinning, the globe vanishes and a lock grows in its place with the shackle raised, which drops and snaps shut with a small knock of the body and a wobble; the circle turns grey and the line below rolls into “Only people invited”. Tap again and the shackle springs open, the lock leaves and the globe comes back turning. Press Copy and a white and blue pass of light runs along the letters of the link while a wide shine crosses the whole pill; the chain turns and vanishes, the check draws itself, Copy rolls into Copied and the button turns blue, the line below becomes “Copied to clipboard” in blue, the pill swells in one beat and a blue halo spreads from the edge and fades. A moment later the pieces leave, the pill narrows and Share comes back from below with its icon rocking. A drawn pointer shows the whole loop on its own.

How it works

One pill, two contents

Inside the pill a layer with overflow hidden holds the Share button and the open panel, both absolutely positioned. The panel is already as wide as the open pill and centred with a negative margin: GSAP only changes the pill’s width, with elastic.out, and the panel uncovers itself from the middle outwards.

The edge light that follows the pointer

The one pixel edge is an element with 1px of padding and a content-box mask in exclusion: only the frame is left. Its background is a radial gradient centred on --mx, which gsap.quickTo carries behind the pointer with a soft lag.

The pass of light on the letters

Over the link sits the same text, transparent, with background-clip: text and a narrow gradient around --gx; GSAP moves --gx from -40% to 140% and the light runs only inside the letters. At the same time a blurred shine crosses the pill under the words.

The lock that snaps

Globe and lock share one SVG. The globe’s meridian narrows by animating its rx attribute (it seems to spin), then the lock grows with back.out and the shackle drops by 3.4 units; as it lands, the body dips by 0.8 and springs back, and the lock wobbles on rotation keyframes.

Really copied, and the beat

Copy writes the link to the clipboard with navigator.clipboard, when the page is secure. The check draws itself with stroke-dashoffset, the two words sit in a column that rises by 50%, the pill goes to 1.04 and comes back with elastic.out, and a halo spreads and fades. After HOLD seconds the pill folds back.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsShareThe label of the closed button.
LINKscript.jsbrindle.so/d/q1-briefThe document’s short link, the one Copy puts on the clipboard.
ACCENTscript.js#86adffThe colour of the globe, the pass of light and Copied.
SPRINGscript.js0.7How long the spring that widens the pill lasts, in seconds.
BEATscript.js1.04How much the pill swells in the beat after copying.
HOLDscript.js1.5How many seconds it stays open after Copied before folding back.

Try them in the Playground

When to use it

At the top of a document or a note in a writing app, in a dashboard to share a report, on a project or quote page to send to a client: wherever the link is needed and it matters to say who can open it.

On phones

The open pill narrows to the screen width minus thirty-two pixels, the circle and Copy get slightly smaller and the link stays whole; a finger presses like the mouse. Without hover the edge light stays still in the middle.

With reduced motion

No springs, beats or passes of light: the pill changes width in a moment, the pieces fade in, the lock and the globe swap with a fade and Copied arrives already in place.

Pitfalls

  • The pill must not clip its own halo: the clipping layer (overflow hidden) is a child, so the beat’s halo and the floor reflection stay outside and the panel stays inside.
  • The shine crossing the pill, placed over the words, showed the edges of its rectangle: under the words, blurred by 3 pixels and with both ends at zero alpha of the same colour, it fades without corners.
  • The closed width is measured on the real word and again once the typeface arrives; the open one is measured again on resize, even mid-animation.
  • navigator.clipboard only works on a secure page and throws without permission: the call is guarded and the check arrives anyway.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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