Skip to content
animorio
IT
Back to the library

Pinned message

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

A group chat with a pinned message at the top: tap the pin next to a message and a copy flies from the conversation into the pink strip opening under the header. From anywhere in the chat, tap the strip and the conversation goes back to that message, puts it in the middle and makes it flash twice. The cross unpins it and the strip closes.

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>
<!--
  "Pinned message" 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>Pinned message</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">
    <!-- a group chat with a pinned message: pin one and it flies up into the strip at the top;
         tap the strip from anywhere and the conversation goes back to it and makes it flash -->
    <section class="pm" data-pm aria-labelledby="pm-title">
      <header class="pm__head">
        <span class="pm__faces" aria-hidden="true"><i>A</i><i>L</i></span>
        <span class="pm__name"><b id="pm-title">Lisbon in May</b><span>Ana, Leo and you</span></span>
      </header>

      <div class="pm__body">
        <div class="pm__strip" data-strip>
          <button class="pm__jump" type="button" data-jump tabindex="-1" aria-label="Go to the pinned message"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg><span class="pm__striptext"><b>Pinned</b><span data-striptext></span></span></button>
          <button class="pm__unpin" type="button" data-unpin tabindex="-1" aria-label="Unpin"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4.500 4.500 7 7M11.500 4.500l-7 7"></path></svg></button>
        </div>
        <ol class="pm__list" data-list tabindex="0" aria-label="Messages">
          <li class="pm__row pm__row--a" data-row><span class="pm__av" aria-hidden="true">A</span><span class="pm__bub" data-bub><span class="pm__who">Ana</span><span data-msg>Booked the flat in Alfama, three nights.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from Ana"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--me" data-row><span class="pm__av" aria-hidden="true"></span><span class="pm__bub" data-bub><span class="pm__who">You</span><span data-msg>Perfect. What time do we land?</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from You"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--a" data-row><span class="pm__av" aria-hidden="true">A</span><span class="pm__bub" data-bub><span class="pm__who">Ana</span><span data-msg>Flight lands 14:20, terminal 1.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from Ana"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--l" data-row><span class="pm__av" aria-hidden="true">L</span><span class="pm__bub" data-bub><span class="pm__who">Leo</span><span data-msg>I can pick up the keys at four.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from Leo"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--me" data-row><span class="pm__av" aria-hidden="true"></span><span class="pm__bub" data-bub><span class="pm__who">You</span><span data-msg>I’ll bring the chargers this time.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from You"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--a" data-row><span class="pm__av" aria-hidden="true">A</span><span class="pm__bub" data-bub><span class="pm__who">Ana</span><span data-msg>Dinner at Zé’s on Friday?</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from Ana"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--l" data-row><span class="pm__av" aria-hidden="true">L</span><span class="pm__bub" data-bub><span class="pm__who">Leo</span><span data-msg>Yes. Table for four, nine o’clock.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from Leo"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
          <li class="pm__row pm__row--me" data-row><span class="pm__av" aria-hidden="true"></span><span class="pm__bub" data-bub><span class="pm__who">You</span><span data-msg>Can’t wait.</span></span><button class="pm__pin" type="button" data-pin aria-pressed="false" aria-label="Pin message from You"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.700 2.300 13.700 6.300l-1.300.5-2.100 2.100.2 2.600-1.200 1.200-2.700-2.700-3.300 3.300M6.600 10 3.300 6.700l1.200-1.200 2.600.2 2.100-2.100Z"></path></svg></button></li>
        </ol>
      </div>
      <span class="pm__fly" data-fly aria-hidden="true"></span>
      <span class="pm__live" aria-live="polite" data-live></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

37 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 “Pinned message” 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 cream, a white card: two circles with initials, “Lisbon in May”, “Ana, Leo and you”. Below, the conversation: Ana’s and Leo’s messages on the left in grey bubbles, yours on the right in black ones, and next to each a small grey pin. Tap the pin of “Flight lands 14:20, terminal 1.” and the pin turns pink with a half turn; a copy of the bubble comes off, rises and lands in a light pink strip that meanwhile springs open under the header: “Pinned” and the message’s text, with a cross on the right. The conversation scrolls down to the last messages; tap the strip and it climbs back by itself, brings the pinned message to the middle and flashes a pink halo around it twice. The cross unpins: the strip closes and the list takes its place again.

How it works

The strip and the list

They sit in a column of fixed height: the strip starts at zero height and GSAP takes it to 42 pixels on a spring, while the list, which takes the room that is left, makes way. The card does not change size.

The flight

A separate element takes the message’s text, leaves from the bubble’s coordinates and reaches the strip: x on a soft curve, y with a small wind-up, fading on arrival while the strip’s text appears.

Back to the message

The list is a real scrolling container: GSAP animates scrollTop to the point where the message sits in the middle, then a CSS variable flashes the halo twice. Scrolling by hand stops the animation.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#e5417aThe colour of the pin, of the strip and of the flash on the message.
FLYscript.js0.6How long the message takes to fly from the conversation to the strip.
SCROLLscript.js0.8How long the conversation takes to go back to the pinned message.

Try them in the Playground

When to use it

In the group chats of a messaging, work or travel app, in a community’s channels, in the comments of a live stream and in customer support: wherever a message has to stay within reach while the conversation moves on.

On phones

The same card, as wide as the screen minus the margins: the conversation scrolls under the finger inside the card, at most 238 pixels tall and less on a short screen. The pins are 26 pixels wide with room around them, the strip is 42 tall.

With reduced motion

No flight and no springs: the strip appears already open with its text, the conversation jumps straight to the pinned message and the halo appears once and fades, without flashing. The demo’s pointer does not start.

Pitfalls

  • People and messages are made up. Only one message is pinned at a time here: with several pinned ones the strip shows the latest and a count, and tapping cycles through them.
  • In a real chat the pinned message may not be loaded yet: it has to be fetched before scrolling, and the flash starts only once it is in view.
  • The pin switched on is not told by colour alone: the button’s label changes and an aria-live region announces the pinned message.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 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 animations