Skip to content
animorio
IT
All components

Tape measure sidebar

Navigation, Transitions, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 9.4 KBGSAP 28 KBFreeDownload the zip

The dark sidebar of a made up work app, Fennick, that collapses down to its icons. Pressing the button on its edge every name reels into its icon like the tape of a tape measure: the letters speed up to the left and vanish one after the other at the icon’s edge, which recoils a pixel as the tape snaps in, while the bar narrows on a spring. The logo folds into its monogram, the group titles turn into thin rules and the counter moves to a corner of its icon. Collapsed, an icon pointed at shows its name with its keyboard shortcut; opening it again, the names run back out staggered 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>
<!--
  "Tape measure sidebar" 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 sidebar with names that reel into their icons like a tape measure</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the sidebar of a work app: the button on its edge narrows it to its icons on a spring, and every name reels
         into its icon letter by letter like the tape of a tape measure; the logo folds into its monogram, the group
         titles become thin rules, and folded, an icon pointed at shows its name and its keyboard shortcut -->
    <div class="fit" data-fit>
      <div class="sb-wrap" data-wrap>
        <nav class="sb" aria-label="Main" data-nav>
          <div class="sb__head">
            <a class="sb__brand" href="#" aria-label="Fennick home">
              <span class="sb__tile" aria-hidden="true">
                <svg viewBox="0 0 32 32" data-mark>
                  <line data-m="a" x1="9" y1="10" x2="23" y2="10"/>
                  <line data-m="b" x1="9" y1="16" x2="23" y2="16"/>
                  <line data-m="c" x1="9" y1="22" x2="17" y2="22"/>
                </svg>
              </span>
              <span class="reel reel--brand" data-reel>Fennick</span>
            </a>
          </div>

          <div class="sb__body" data-body>
            <span class="sb__pill" aria-hidden="true" data-pill></span>

            <div class="sb__group">
              <div class="sb__title" aria-hidden="true"><span class="reel reel--title" data-reel>Workspace</span><span class="sb__rule" data-rule></span></div>
              <ul class="sb__list">
                <li><a class="sb__item" href="#" aria-current="page" data-item data-keys="G I">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 13.5 6.2 6.3A2 2 0 0 1 8.1 5h7.8a2 2 0 0 1 1.9 1.3L20 13.5V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"/><path d="M4 13.5h4.2l1.3 2.2h5l1.3-2.2H20"/></svg></span>
                  <span class="reel" data-reel>Inbox</span>
                  <span class="sb__badge" data-badge>12<span class="sr"> unread</span></span></a></li>
                <li><a class="sb__item" href="#" data-item data-keys="G P">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.5 7.5A2 2 0 0 1 5.5 5.5H9.5L11.5 7.5H18.5A2 2 0 0 1 20.5 9.5V17.5A2 2 0 0 1 18.5 19.5H5.5A2 2 0 0 1 3.5 17.5Z"/><path d="M3.5 10.5H20.5"/></svg></span>
                  <span class="reel" data-reel>Projects</span></a></li>
                <li><a class="sb__item" href="#" data-item data-keys="G C">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.5" y="5" width="17" height="15.5" rx="2.5"/><path d="M3.5 9.5H20.5M8 3V6.5M16 3V6.5"/></svg></span>
                  <span class="reel" data-reel>Calendar</span></a></li>
                <li><a class="sb__item" href="#" data-item data-keys="G D">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 3.5h7l4 4V19a1.5 1.5 0 0 1-1.5 1.5h-9.5A1.5 1.5 0 0 1 5.5 19V5A1.5 1.5 0 0 1 7 3.5Z"/><path d="M14 3.5V8h4"/><path d="M8.5 12.5h7M8.5 16h5"/></svg></span>
                  <span class="reel" data-reel>Docs</span></a></li>
              </ul>
            </div>

            <div class="sb__group">
              <div class="sb__title" aria-hidden="true"><span class="reel reel--title" data-reel>Team</span><span class="sb__rule" data-rule></span></div>
              <ul class="sb__list">
                <li><a class="sb__item" href="#" data-item data-keys="G M">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8.5" r="3"/><path d="M3.5 19c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5"/><path d="M15.5 5.8a3 3 0 0 1 0 5.6"/><path d="M17.5 14.4c1.7.6 2.7 2.2 3 4.6"/></svg></span>
                  <span class="reel" data-reel>Members</span></a></li>
                <li><a class="sb__item" href="#" data-item data-keys="G R">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20H20"/><path d="M7 16.5V11M12 16.5V6.5M17 16.5V13.5"/></svg></span>
                  <span class="reel" data-reel>Reports</span></a></li>
                <li><a class="sb__item" href="#" data-item data-keys="G S">
                  <span class="sb__ico"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h8.5M17.5 7H20M4 17h2.5M11.5 17H20"/><circle cx="15" cy="7" r="2.2"/><circle cx="9" cy="17" r="2.2"/></svg></span>
                  <span class="reel" data-reel>Settings</span></a></li>
              </ul>
            </div>
          </div>

          <div class="sb__foot">
            <a class="sb__user" href="#" data-item data-keys="G A" data-noactive>
              <span class="sb__avatar" aria-hidden="true">IV</span>
              <span class="sb__who">
                <span class="reel reel--name" data-reel>Ines Varga</span>
                <span class="reel reel--role" data-reel>Design lead</span>
              </span>
            </a>
          </div>
        </nav>

        <button class="sb__toggle" type="button" aria-expanded="true" aria-label="Collapse sidebar" aria-keyshortcuts="[" data-toggle>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path class="sb__chev" d="M9.5 4.5 6 8l3.5 3.5"/></svg>
        </button>

        <!-- folded: the name of the icon pointed at and its shortcut -->
        <div class="sb__tip" role="tooltip" data-tip>
          <span class="sb__tipin" data-tipin></span>
        </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.

34 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 “Tape measure sidebar” 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 black, a 248 pixel graphite sidebar whose one pixel edge picks up light near the pointer. At the top the Fennick logo: a lime tile with three strokes and the name; then the Workspace group (Inbox with the 12 counter, Projects, Calendar, Docs) and the Team group (Members, Reports, Settings), and the signed in person at the bottom. A light pill sits under the page you are on and runs there on a spring, stretching a little on the way. Pressing the round button straddling the edge (or the [ key) the names reel in from the top down: every word slides left speeding up, the letters vanish one at a time at the icon’s edge, slightly slanted by the speed, and when the last one is in, the icon recoils a pixel with a flash. The bar narrows to 68 pixels on a spring that goes a touch past, the tile’s three strokes turn into an F, the group titles make way for a thin rule and the 12 slides into the icon’s corner. Collapsed, an icon pointed at shows a tag with its name and its shortcut (G then I); moving to another icon the tag runs after it and the text rolls. Opening again, the names run out of the icons staggered, last letter first, go a pixel past and settle.

How it works

The tape inside the icon

Every name is split into letters and sits in a box that starts at the icon’s right edge, clipped with clip-path on the left only (an inset of -600 pixels on the other sides). Collapsing, the letters slide left by the length of the word with power2.in and a 14 millisecond stagger from the first: the icon’s edge eats them one at a time, like the tape reeling back into the tape measure.

The snap and the recoil

When the last letter is in, the icon moves back KICK pixels in 70 milliseconds and returns with elastic.out, while a CSS variable lights a glow under it. Opening, the opposite happens: the letters go back to x 0 with back.out starting from the last one, so the word comes out a little stretched and closes up.

Three springs in one loop

The bar’s width, the pill under the chosen page and the tooltip are three springs integrated in steps of 1/120 of a second in a single requestAnimationFrame, which stops when they are all at rest. The damping comes from BAR_BOUNCE; the pill stretches with its speed, and the button on the edge follows the bar’s width every frame.

Logo, groups and counter

The tile has three SVG lines: GSAP moves their ends through the attributes and the three strokes become the monogram’s F. The group titles reel in without an icon and in their place a 24 pixel rule opens from the centre; the counter moves from the end of the row to the icon’s corner and shrinks.

Tooltip, keyboard and pilot

The tooltip measures the new text, changes width on a spring and the text rolls up or down with the direction. The [ key collapses and opens, G followed by a letter picks the page; every row is a real link with aria-current and aria-label. A drawn pointer does the round by itself and stops at the first real touch, starting again after six quiet seconds.

Values to change

NameFileDefaultWhat it changes
OPEN_WIDTHscript.js248Width in pixels of the open bar.
BAR_STIFFNESSscript.js230Stiffness of the spring that narrows and widens the bar.
BAR_BOUNCEscript.js0.36How far the bar goes past and comes back (0 no bounce).
REELscript.js0.38Seconds for a name to reel into its icon.
LETTER_STAGGERscript.js0.014Delay in seconds between one letter and the next.
ROW_STAGGERscript.js0.02Delay in seconds between one row and the one below.
KICKscript.js1.8How many pixels the icon recoils as the name snaps in.
PILL_STIFFNESSscript.js320Stiffness of the spring of the pill that follows the chosen page.
PILL_STRETCHscript.js0.5How much the pill stretches as it runs (0 rigid).
ACCENTscript.js#c8f25aThe accent colour: the logo, the chosen icon and the counter.

Try them in the Playground

When to use it

For the sidebar of a work app, a dashboard, a back office or an admin panel: wherever people want more room for the content without losing the navigation, and want to reach the pages from the keyboard.

On phones

The same animation: the whole bar scales down to fit the screen, worked out again on every resize. Tapping an icon while collapsed picks the page and shows the tag for a second and a half.

With reduced motion

Nothing moves: the names fade out and back in, the bar takes its width at once, the pill jumps to the chosen page, the tag appears without sliding; the pilot’s pointer is hidden.

Pitfalls

  • With overflow hidden on the name’s box, the narrowing bar cut the last letters from the right before they reeled in: the clip is a clip-path that closes the left side only, and the bar only starts once the names are nearly all in.
  • Splitting the names into letters broke them for screen readers: the words are put back together in an aria-label on the link, so a screen reader does not read «I, n, b, o, x».

Libraries

GSAP 3.15.0, Geist (font variabile) 5.3.0.

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

Testing

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