Skip to content
animorio
IT
All components

Account menu

Menus, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.6 KBGSAP 28 KBFreeDownload the zip

The account menu of a project app, in the style of real product interface pieces, on white: press the avatar with the initials and the menu grows out of its corner on a short spring while the items come in staggered. A highlight slides under the item you point at, the shortcut key sits in relief, and in the Theme row a small segmented switch slides its pill: picking Dark fades the menu itself into its dark theme.

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>
<!--
  "Account menu" 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 account menu that opens from the avatar</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" data-stage>
    <!-- the account menu of a product app: it grows out of the avatar in the corner of the top bar, a highlight slides under the
         item you point at, the Theme row has its own segmented switch, and choosing Dark turns the menu itself dark -->
    <div class="frame" data-frame>
      <header class="bar">
        <div class="bar__brand">
          <svg class="bar__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 4v16"></path><path d="M18 4 9.5 12 18 20"></path><path d="M12.6 9.2 18 4"></path></svg>
          <span class="bar__name">Kelvra</span>
        </div>
        <nav class="bar__nav" aria-label="Main">
          <span class="bar__link is-on">Projects</span>
          <span class="bar__link">Reports</span>
        </nav>
        <button class="avatar" type="button" data-avatar aria-haspopup="menu" aria-expanded="false" aria-controls="menu-account" aria-label="Account menu for Iris Calder">
          <span class="avatar__face" data-face>IC</span>
        </button>
      </header>

      <div class="menu" id="menu-account" role="menu" data-menu aria-label="Account" hidden>
        <div class="menu__head" data-item-static>
          <span class="menu__face" aria-hidden="true">IC</span>
          <span class="menu__who">
            <span class="menu__name">Iris Calder</span>
            <span class="menu__mail">iris@kelvra.app</span>
          </span>
        </div>
        <div class="menu__list" data-list>
          <span class="menu__hl" data-hl aria-hidden="true"></span>
          <button class="item" type="button" role="menuitem" data-item>
            <svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8.5" r="3.6"></circle><path d="M4.8 19.6a7.4 7.4 0 0 1 14.4 0"></path></svg>
            <span class="item__label">Profile</span>
          </button>
          <button class="item" type="button" role="menuitem" data-item>
            <svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3.2" y="5.6" width="17.6" height="12.8" rx="2.4"></rect><path d="M3.2 9.8h17.6"></path><path d="M6.8 14.6h3.6"></path></svg>
            <span class="item__label">Billing</span>
            <span class="item__note">Pro</span>
          </button>
          <button class="item" type="button" role="menuitem" data-item>
            <svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="2.8" y="6" width="18.4" height="12" rx="2.4"></rect><path d="M6.4 9.6h.01M9.8 9.6h.01M13.2 9.6h.01M16.6 9.6h.01M8 14.2h8"></path></svg>
            <span class="item__label">Keyboard shortcuts</span>
            <kbd class="key" data-key>?</kbd>
          </button>
          <div class="item item--theme" role="menuitem" tabindex="-1" data-item data-theme-row>
            <svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8.4"></circle><path d="M12 3.6v16.8a8.4 8.4 0 0 0 0-16.8Z" class="fill"></path></svg>
            <span class="item__label">Theme</span>
            <span class="seg" role="radiogroup" aria-label="Theme" data-seg>
              <span class="seg__pill" data-pill aria-hidden="true"></span>
              <button class="seg__btn is-on" type="button" role="radio" aria-checked="true" aria-label="Light" data-mode="light">
                <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3.8"></circle><path d="M12 2.8v2.2M12 19v2.2M2.8 12H5M19 12h2.2M5.5 5.5l1.6 1.6M16.9 16.9l1.6 1.6M5.5 18.5l1.6-1.6M16.9 7.1l1.6-1.6"></path></svg>
              </button>
              <button class="seg__btn" type="button" role="radio" aria-checked="false" aria-label="Dark" data-mode="dark">
                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19.4 14.6A7.8 7.8 0 0 1 9.4 4.6a7.8 7.8 0 1 0 10 10Z"></path></svg>
              </button>
              <button class="seg__btn" type="button" role="radio" aria-checked="false" aria-label="System" data-mode="system">
                <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.4" y="4.6" width="17.2" height="11.6" rx="2"></rect><path d="M9 20h6M12 16.2V20"></path></svg>
              </button>
            </span>
          </div>
          <span class="menu__rule" aria-hidden="true"></span>
          <button class="item item--out" type="button" role="menuitem" data-item data-out>
            <svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M13.6 4.4H6.4a1.8 1.8 0 0 0-1.8 1.8v11.6a1.8 1.8 0 0 0 1.8 1.8h7.2"></path><path d="M10.4 12h9.4"></path><path d="M16.6 8.6 20 12l-3.4 3.4"></path></svg>
            <span class="item__label">Sign out</span>
          </button>
        </div>
      </div>
    </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.

37 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 “Account menu” 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 white sits the bar of Kelvra, an invented project app: the mark and the name on the left, Projects and Reports, and on the right the round avatar of Iris Calder with the initials IC on a light purple gradient. Pressed, the avatar squeezes and springs back, a thin ring lights up around it, and the menu grows out of its corner: it starts small and almost round and opens on a short spring while its corners settle to 14 pixels and the shadow below lengthens. The parts come in one after the other from above: the name and email, Profile, Billing with its Pro tag, Keyboard shortcuts with the ? key in relief, the Theme row and Sign out under a thin rule. A light grey fill slides under the item you point at, with the pointer or the arrow keys. In the Theme row three icon buttons, Light, Dark and System, carry a white pill that slides to the chosen one; picking Dark turns the moon a little and the whole menu fades to black, with the greys, the key and the switch in their dark colours; Light brings it back to white. Esc, a click outside or a chosen item close it back into the avatar. The drawn pointer goes round it all: it opens, moves over the items, presses the key, picks Dark then Light, and closes.

How it works

The menu grows out of the avatar

The menu’s transform-origin is on the avatar’s corner. GSAP takes it from scaleX 0.16 and scaleY 0.08, with 26 pixel corners, to its size with back.out, while a CSS variable, --alza, lengthens the shadow. The parts come in after a quarter of the opening, 35 milliseconds apart.

One single highlight

Under the items there is one absolute rectangle: on the item you point at it takes its offsetTop and height in three tenths with power3.out. So it slides instead of lighting each item, and the arrow keys move it the same way.

The theme is the menu itself

Every colour of the menu is a CSS variable; the is-dark class changes them all, and 0.35 second CSS transitions on background, text and borders make the fade. The switch’s pill slides to the chosen button with back.out and the icon turns 40 degrees and back.

The frame keeps the room

The bar and the menu sit in a frame as tall as the open menu: the poster and the video frame that, so the menu never leaves the shot when it opens.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5b5bd6The colour of the avatar’s ring and of the Pro tag.
OPEN_TIMEscript.js0.5How many seconds the menu takes to grow out of the avatar.
SPRINGscript.js1.3How far the menu overshoots its size before settling (0 none).
STAGGERscript.js0.035The seconds between one item and the next as they come in.
PAUSEscript.js0.9The seconds the autopilot waits between gestures.

Try them in the Playground

When to use it

For the top right corner of any app or dashboard with an account: a SaaS product, a dashboard, a team tool, the profile of an online shop; and anywhere the light or dark theme should be one tap away instead of buried in settings.

On phones

The same menu: the bar drops Projects and Reports and keeps the mark and the avatar, the menu stays up to 268 pixels wide inside the frame, and a tap on the avatar opens it like a click.

With reduced motion

No springs or falling items: the menu fades in and out, the highlight and the pill jump into place, the theme still changes with a fade and the drawn pointer is gone.

Pitfalls

  • A menu hidden with display none has no size: the highlight and the pill would read an offsetTop of zero. That is why [hidden] keeps it in the page with visibility hidden.
  • The frame must be as tall as the open menu, not as the bar: the poster and video framing is measured once, with the menu closed.
  • The switch buttons sit inside a menu row: their click stops propagation, otherwise the row would choose the item and close the menu.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 26 October 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