Skip to content
animorio
IT
All components

Mention composer

Forms, Text, TransitionsGSAP, CSS onlyAdvancedCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The comment box of a made-up work app, Plinth, in a white card: type @ and the list of people opens under the caret, with initial avatars, name and role, filtering letter by letter with the matched part in bold and the rows leaving and reordering on a spring. With the arrows or the pointer the active-row bar slides; pick one and the name flies from the list into the text and lands as a soft blue pill, and the sentence goes on after it. Backspace on the pill first lights it up, then removes it; Comment lights up when there is text and posting sends the comment up into the thread above. Minimal style.

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>
<!--
  "Mention composer" 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>Mention composer</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 comment box of a made-up work app, Plinth: type @ and a list of people opens under the caret, it filters
         letter by letter, the chosen name flies into the text and becomes a soft pill. Comment posts it to the thread above -->
    <div class="wrap" data-wrap>
      <section class="card" data-card aria-label="Comments on Pricing page">
        <header class="top">
          <span class="doc">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M5.5 3.5h6l3 3v10h-9z"></path><path d="M11.5 3.5v3h3"></path><path d="M8 10.5h4.5M8 13h3"></path></svg>
            <span>Pricing page</span>
          </span>
          <span class="count" aria-live="polite"><span class="count__label">Comments</span><span class="badge" data-badge><span class="badge__n" data-badge-n>1</span></span></span>
        </header>

        <div class="thread" data-thread role="list"></div>

        <div class="composer" data-composer>
          <div class="editor is-empty" data-editor contenteditable="true" role="combobox" aria-autocomplete="list"
               aria-expanded="false" aria-controls="people" aria-label="Write a comment" aria-multiline="true"
               spellcheck="false" data-placeholder="Reply, or @mention someone"></div>
          <span class="caret" data-caret aria-hidden="true"></span>
          <div class="tools">
            <span class="tool" aria-hidden="true">
              <svg viewBox="0 0 20 20"><circle cx="10" cy="10" r="3.2"></circle><path d="M13.2 10v1.3a2.2 2.2 0 0 0 4.4 0V10a7.6 7.6 0 1 0-3 6"></path></svg>
            </span>
            <span class="tool" aria-hidden="true">
              <svg viewBox="0 0 20 20"><path d="M15.5 9.2l-5.6 5.6a3.4 3.4 0 0 1-4.8-4.8l6-6a2.3 2.3 0 0 1 3.2 3.2l-6 6a1.1 1.1 0 0 1-1.6-1.6l5.4-5.4"></path></svg>
            </span>
            <button class="send" type="button" data-send disabled>
              <span class="send__bg" aria-hidden="true"></span>
              <span class="send__label" data-send-label>Comment</span>
              <svg class="send__tick" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.6 8.4l2.9 2.8 5.9-6.2" pathLength="1" data-tick></path></svg>
            </button>
          </div>
        </div>
      </section>

      <div class="people" id="people" role="listbox" aria-label="People" data-people>
        <div class="people__bar" data-bar aria-hidden="true">
          <svg viewBox="0 0 16 16"><path d="M12.5 3.5v4.2a1.8 1.8 0 0 1-1.8 1.8H4"></path><path d="M6.4 6.8L3.6 9.5l2.8 2.7"></path></svg>
        </div>
        <div class="people__rows" data-rows></div>
        <p class="people__none" data-none>No one by that name</p>
      </div>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

23 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 “Mention composer” 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 white background, a white card with a soft shadow: at the top the document, Pricing page, and the comment count in a small badge; below it the thread, with Ravi Menon’s comment from two hours ago, and the reply box, “Reply, or @mention someone”, with the at sign and paperclip icons and the Comment button off, in grey. Type @ and a light glass list opens under the caret on a short spring, growing from the at sign, with the four most recent people: round initial avatars in soft tints, name and role. With every letter the list filters: the matched part turns bold on the weight axis, the rows that no longer fit fade away, the ones that stay slide to their new place on a spring and the list shortens with them. First names starting with the letters come first, then surnames, then names containing them. The grey bar of the active row, with a drawn Enter mark, slides with the arrows or under the pointer and overshoots by a pixel before it stops. Pick one and the name leaves its row, flies to its spot in the text while taking the blue ground and lands as a pill with an elastic squash; the sentence goes on after it. Backspace right after the pill fills it with blue with a small hop; a second backspace squeezes it to nothing and removes it. As soon as there is text Comment turns black with a bounce; Enter or a click squeezes it, a tick draws itself in place of the label, and the text rises from the box to its place in the thread, while the oldest comment folds away and the badge counts one more. With no room below, the list opens above the caret.

How it works

A real field, with untouchable pills

The field is a contenteditable with white-space pre-wrap; every mention is a span with contenteditable false, so the caret jumps it like a single letter and it can’t be split. On every input the text before the caret in its node is read and a regex, @ followed by letters at the start or after a space, says whether a query is open.

The list under the at sign

A Range over the at sign alone gives its rectangle: the list goes right below it, kept inside the edges, or above when there is no room below, and transform-origin falls on the at sign so the opening spring grows from the right spot. It is redone on resize.

Rows reordering on a spring

All rows already exist and sit absolutely: the filter sorts them (first name starts, surname starts, name contains), gives each its y and GSAP takes them there with back.out; leaving rows fade, arriving ones rise eight pixels, and the list’s height follows on the same spring. The active-row bar is a single element sliding on y.

The name that flies and becomes a pill

The real pill is inserted, invisible, and measured; a fixed copy starts from the name’s rectangle in the row and reaches it with x on power3.inOut and y on back.out, so it draws a small arc, while ground and colour go from black text to the blue pill. On arrival the swap and an elastic squash.

The comment rising into the thread

The comment is added to the thread at zero height and grows on a spring while the oldest folds away, so the card barely changes size; a copy of the text flies from the box to its line, measured every frame, and fades into the real text on arrival. The button draws its tick with strokeDashoffset and autoRound off.

Values to change

NameFileDefaultWhat it changes
PEOPLEscript.jsRavi Menon:Product manager | Maya Lindqvist:Product designer | Jun Park:Frontend engineer | Amara Osei:UX research | Marco Bellini:Engineering lead | Mateo Ruiz:iOS engineerThe people in the list, name:role, in recent order.
MAX_ROWSscript.js4How many people the list shows at most.
ROW_SPRINGscript.js1.5How far the rows and the active-row bar overshoot and come back.
FLY_TIMEscript.js0.55How long the name’s flight from the list to the text lasts.
TYPE_SPEEDscript.js0.06The seconds between letters when the preview types by itself.
KEEPscript.js2How many comments the thread above the box keeps showing.

Try them in the Playground

When to use it

In the comments of a work app, a project manager, a document or design editor, a team chat, the comments of a dashboard or a blog with its authors.

On phones

The card takes the width with a margin, gaps and margins also follow the height with clamp; the list stays inside the edges and, when there is no room under the caret, opens above it. A tap picks the row like a click.

With reduced motion

No flights or springs: the list appears and filters with fades, the pill appears in place, the comment fades into the thread and the preview does not type by itself.

Pitfalls

  • Clicking a list row takes focus from the field and closes it before the click: pointerdown is stopped on the row, so focus stays where it is.
  • The button switching off as soon as the field empties hid the white tick on a grey ground: the button state is restored only once the tick is done.
  • Focusing the field to let the preview type steals the keyboard from the page holding it: the preview types at the end of the text and draws its own caret.
  • A hand-written backslash-u sequence in the letters regex turned into the actual character: the \p{L} class with the u flag is used instead.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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