Skip to content
animorio
IT
All components

Overflow nav bar

Navigation, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

A white nav bar with six links and a thin grip beside its right edge, in the simple style of product interface pieces. Dragging the edge narrows the bar, and the last link that no longer fits shrinks and flies into the More button, which takes it with a small kick while its count rolls up by one. Widen it and the links come back out one at a time, a pixel past their place, and settle.

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>
<!--
  "Overflow nav bar" 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 nav bar that tucks the extra links into More</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>
    <!-- one gesture: drag the edge; the links that no longer fit fly into More, one by one, and come back out -->
    <div class="wrap" data-wrap>
      <nav class="bar" data-bar aria-label="Main">
        <span class="bar__pill" data-pill aria-hidden="true"></span>
        <a class="bar__link" href="#work" data-link>Work</a>
        <a class="bar__link" href="#studio" data-link aria-current="page">Studio</a>
        <a class="bar__link" href="#journal" data-link>Journal</a>
        <a class="bar__link" href="#pricing" data-link>Pricing</a>
        <a class="bar__link" href="#careers" data-link>Careers</a>
        <a class="bar__link" href="#contact" data-link>Contact</a>
        <button class="more" type="button" data-more aria-haspopup="true" aria-expanded="false">
          <span class="more__word">More</span>
          <span class="more__badge" data-badge aria-hidden="true"><span class="more__num" data-num>0</span></span>
          <svg class="more__chev" viewBox="0 0 12 12" aria-hidden="true"><path data-chev d="M3 4.6 6 7.6 9 4.6"/></svg>
        </button>
        <div class="panel" data-panel role="menu" aria-label="More links" hidden></div>
      </nav>
      <div class="grip" data-grip role="separator" aria-orientation="vertical" aria-label="Resize the bar" tabindex="0">
        <span class="grip__bar" data-gripbar></span>
      </div>
    </div>
  </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.

21 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 “Overflow nav bar” 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, on its own, there is a white nav bar with rounded corners, a grey hairline around it and a wide, light shadow: Work, Studio, Journal, Pricing, Careers and Contact, with Studio, the page you are on, darker and resting on a soft grey pill. Beside its right edge there is a short vertical grey line: the grip. Pulling it to the left narrows the bar and, as soon as a link no longer fits, the More button appears with a small blue count; the rightmost link shrinks and flies into More, which takes it with a one-pixel kick and springs back, while the count rolls up by one. If two fall together they leave one after the other, the rightmost first. Widening the bar brings the links back out of More in order, starting small from the button, landing a pixel past their place and settling; More gives a small tug the other way and the count rolls down. With every link out, More disappears. Pressing More opens a panel below with the links it is keeping, which drop in one after another, and the little chevron turns over. Hovering the links slides the grey pill under the one you point at and back to the page you are on; if that page is inside More, the pill rests on More. Held, the grip turns blue and grows longer. Until someone touches it, the bar plays the gesture by itself.

How it works

Links placed by hand

Every link is absolutely positioned and GSAP sets its x: the widths are measured once (offsetWidth, which transforms do not touch) and every place follows from them. Only More is pinned to the right edge by the CSS, so it follows the bar with no maths on every frame.

How many fit

On every width change the script counts how many links fit while leaving room for More: if they all fit More is not needed, otherwise at least the first one stays. Only the links that change side move; the others stay where they are.

The flight into More

The leaving link goes to the centre of More shrinking to 0.6 with power3.in, as if sucked in; More takes the hit with x 1.6 and comes back with elastic.out. On the way back the link starts from the centre of More and lands in its place with back.out, which gives the extra pixel, and More pulls a hair the other way.

The rolling count

The count on More is a cell with hidden overflow: the old number leaves upwards when the links grow and downwards when they shrink, the new one comes in from the other side with back.out, and the cell swells by 14 per cent for a moment.

The pill that follows

The grey pill under the links moves with x and width to the link you point at, then goes back to the page you are on; if that page has gone inside More the pill rests on More, and follows it while the bar changes width.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#3d5afeThe colour of the count on More and of the grip while held.
MORE_LABELscript.jsMoreThe word on the button that keeps the links that do not fit.
SPRINGscript.js1How much the links bounce coming back out: 0.4 calm, 2 very springy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
STAGGERscript.js0.07The seconds between two links that go in or out together.
AUTOscript.jstrueThe edge moves by itself until someone touches the bar.

Try them in the Playground

When to use it

For the top bar of a site or an app with more links than fit on a narrow screen: instead of switching straight to a hamburger, the extra links go into More one at a time and the first ones always stay in sight.

On phones

On the phone the bar starts as narrow as the screen, with some links already inside More, and the grip is pulled with a finger; there is no hover, everything else is the same.

With reduced motion

The links do not fly: they fade out and back in at their place, the count changes without rolling and the panel fades in.

Pitfalls

  • The link widths have to be measured with offsetWidth, not getBoundingClientRect: a link flying into More is scaled to 0.6 and the measure would be wrong.
  • More has to be measured before it is hidden with opacity and scale, otherwise the threshold of how many links fit changes while More appears.
  • When the current page ends up inside More, the grey pill has to follow it on every width change: More is pinned to the edge by the CSS, the pill is not.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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