Skip to content
animorio
IT
All components

Share chat button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 7.4 KBGSAP 28 KBFreeDownload the zip

The Share button at the top of a conversation with Larch, a made-up AI assistant. On click the pill presses and a small panel grows out of it: the last lines of the chat land in the preview card like two messages, below sit «Anyone with the link can view» with a small toggle and Create link, which works with a thin line running along the pill and turns into the public link, written one character at a time. Copy becomes Copied with a check drawing itself; Esc, the cross or a click outside fold the panel back into the pill. 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.

<!doctype html>
<!--
  "Share chat 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>Share chat 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/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- a conversation with Larch, a made-up AI assistant. The Share pill in the top bar opens a small panel:
         the last lines of the chat gather into a preview card, Create link makes a public link, Copy copies it -->
    <section class="win" data-win aria-label="Larch conversation">
      <header class="bar">
        <span class="mark" aria-hidden="true">
          <svg viewBox="0 0 20 20"><path d="M10 3.2v13.6M10 7.4l-3.6-2.6M10 7.4l3.6-2.6M10 11.4l-4.4-3M10 11.4l4.4-3"/></svg>
        </span>
        <span class="bar__t">
          <span class="bar__name">Porto, on a budget</span>
          <span class="bar__sub">Larch · today</span>
        </span>
        <button class="share" type="button" data-share aria-haspopup="dialog" aria-expanded="false">
          <svg class="share__ico" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 10.2V2.6M5.2 5.2 8 2.4l2.8 2.8M3.4 8.4v3.8c0 .7.5 1.2 1.2 1.2h6.8c.7 0 1.2-.5 1.2-1.2V8.4"/></svg>
          <span>Share</span>
        </button>
      </header>

      <div class="chat" data-chat aria-hidden="false">
        <p class="msg msg--me" data-b="0">Two days in Porto for under €300?</p>
        <div class="msg msg--ai" data-b="1">
          <span class="who" aria-hidden="true"><svg viewBox="0 0 20 20"><path d="M10 3.2v13.6M10 7.4l-3.6-2.6M10 7.4l3.6-2.6M10 11.4l-4.4-3M10 11.4l4.4-3"/></svg></span>
          <p>A slow weekend: Ribeira at sunset, the 1 tram to Foz, and a guesthouse in Bonfim at €62 a night.</p>
        </div>
        <p class="msg msg--me" data-b="2">Add one rainy-day plan.</p>
      </div>

      <div class="panel" data-panel role="dialog" aria-modal="false" aria-label="Share chat" hidden>
        <div class="panel__in" data-in>
          <header class="panel__head">
            <span class="panel__t">Share chat</span>
            <button class="x" type="button" data-close aria-label="Close">
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>
            </button>
          </header>

          <figure class="prev" data-prev aria-label="Preview of the shared chat">
            <figcaption class="prev__t">Porto, on a budget</figcaption>
            <span class="mini mini--me" data-mini="0">Two days in Porto for under €300?</span>
            <span class="mini mini--ai" data-mini="1">A slow weekend: Ribeira at sunset, the 1 tram to Foz…</span>
            <span class="prev__d">29 Nov 2026 · 6 messages</span>
          </figure>

          <div class="row">
            <span class="row__t">
              <span class="row__a" data-who>Anyone with the link can view</span>
            </span>
            <button class="tog is-on" type="button" role="switch" aria-checked="true" aria-label="Public link" data-tog><span class="tog__k" data-knob></span></button>
          </div>

          <div class="slot">
            <button class="make" type="button" data-make>
              <span class="make__l" data-ml="0">Create link</span>
              <span class="make__l" data-ml="1" aria-hidden="true">Creating link</span>
              <span class="make__run" data-run aria-hidden="true"></span>
            </button>
            <div class="link" data-link aria-hidden="true">
              <span class="link__ico" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M6.6 9.4l2.8-2.8M7.4 4.6l1-1a2.6 2.6 0 0 1 3.7 3.7l-1 1M8.6 11.4l-1 1a2.6 2.6 0 0 1-3.7-3.7l1-1"/></svg></span>
              <span class="link__u" data-url></span>
              <button class="copy" type="button" data-copy tabindex="-1">
                <span class="copy__l" data-cl="0">Copy</span>
                <span class="copy__l" data-cl="1" aria-hidden="true">
                  <svg viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="M3.6 8.4l2.8 2.7 6-6.2"/></svg>
                  Copied
                </span>
              </button>
            </div>
          </div>
        </div>
      </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.

32 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 “Share chat 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 chat window with Larch, a made-up AI assistant: at the top the conversation title, «Porto, on a budget», and the Share pill; below, three lines about a weekend in Porto. On click the pill sinks to 0.94 and comes back on a spring, and the panel grows out of its corner, clipped from the shape of the pill to the whole card, while the chat behind dims. The two top lines of the chat land in the preview card like two messages: the question from the right with a small bounce, the answer from the left a beat later; below, the «Anyone with the link can view» row with its toggle. Create link is pressed, the label becomes «Creating link» and a thin line runs along the bottom of the pill, pauses for a beat and reaches the end; then, in the same cell as the button, the link appears with its icon making a half turn and the address writing itself. Copy becomes Copied with a check drawing itself and a soft halo on the field. Switching the toggle off turns the line into «Only you can see this chat» and withdraws the link. Esc, the cross or a click outside fold the panel back into the shape of the pill; when nobody touches it, the demo plays by itself.

How it works

The panel is born from the pill

The panel has its top-right corner on the same spot as the pill and starts with a clip-path inset as big as the pill, round corners included; then the inset goes to zero with expo.out. Closing goes back to the same clip, measured again, and only then does the panel disappear.

The lines arrive like messages

The two preview lines come in on their own when the panel is almost open, the question from the right and the answer from the left, each in its own place in the card: nothing ever passes over the date or the other lines.

Two things in one cell

Create link and the link field share the same grid cell: one disappears and the other appears in its place, without the panel changing height. The button labels are out of the flow, each centred on its own: the hidden one never widens the button.

The link writes itself

A counter runs from 0 to the length of the address at the chosen speed, and at every step the field shows the first characters; Copy really writes to the clipboard when the browser allows it.

Values to change

NameFileDefaultWhat it changes
OPEN_TIMEscript.js0.5Seconds the panel takes to grow out of the Share pill.
SPRINGscript.js0.7How springy the pill, the buttons and the toggle are (lower = more bounce).
CREATE_TIMEscript.js1.2Seconds Create link works before the link appears.
TYPE_SPEEDscript.js34Characters per second as the link writes itself.
CHAT_DIMscript.js0.45How visible the chat stays behind the open panel (1 = not dimmed).
AUTO_PAUSEscript.js6Seconds of quiet before the demo plays by itself again.

Try them in the Playground

When to use it

In AI chat apps, documents and work tools where something private can become a public link: the conversation, the report, the board to send to someone.

On phones

Sizes are in em and depend on both the width and the height of the window, so the chat and the panel fit the short box; the panel moves back onto the pill when the window changes. A tap works like a click.

With reduced motion

No springs, flights or clips: the panel fades in and out, the preview is already full, the link appears whole and Copied arrives with its check already drawn.

Pitfalls

  • Both labels of each button go out of the flow (position absolute, inset 0, centred on their own): in the same cell, the longer hidden label would widen the button and the visible one would no longer be centred.
  • The pill clip must be measured every time, on opening and on closing: the window may have changed height and the panel width.
  • A shrunken copy of the bubble flying into the preview passes over the date and the other lines of the card: better to bring in the real lines, each in its own place.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

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