Skip to content
animorio
IT
All components

API docs sidebar

Navigation, Transitions, PhysicsGSAP, CSS onlyMediumCompressed weight: Demo 8.4 KBGSAP 28 KBFreeDownload the zip

The API reference sidebar of an invented payments company, Ledgerline, on white: the version, the search and four groups of endpoints with their GET, POST and DEL methods. A thin indigo marker on the rail and a light glass pill sit under the page you are on and travel on two springs: the front edge leaves at once and the back one follows, so the marker stretches over the rows it crosses and gathers on arrival. Opening a group folds the other one away and the marker rides the fold.

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>
<!--
  "API docs 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 API docs sidebar with the marker that slides between endpoints</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the sidebar of the API reference of a payments company (Ledgerline): four groups of endpoints, one open at a
         time. A thin indigo marker on the rail and the soft pill behind the page you are on travel on two springs:
         the edge in front leaves first, the one behind follows, so the marker stretches over the rows it crosses and
         gathers again on arrival. Opening a group folds the other one away and the marker rides the fold -->
    <nav class="docs" data-docs aria-label="API reference">
      <header class="docs__head">
        <span class="docs__brand">
          <svg class="docs__mark" viewBox="0 0 24 24" aria-hidden="true">
            <rect x="3" y="4" width="18" height="16" rx="5" />
            <path d="M7.5 9.5h9M7.5 14.5h5.5" />
          </svg>
          <span class="docs__name">Ledgerline</span>
          <span class="docs__kind">API</span>
        </span>
        <button class="docs__ver" type="button" aria-label="API version 2026-10">
          <span>2026-10</span>
          <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.2 4.8 6 7.6l2.8-2.8" /></svg>
        </button>
      </header>

      <button class="docs__search" type="button" aria-label="Search the API reference">
        <svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.4" /><path d="m10.4 10.4 3 3" /></svg>
        <span class="docs__search-words">Search the API</span>
        <kbd class="docs__key">/</kbd>
      </button>

      <div class="tree" data-tree>
        <span class="tree__ghost" data-ghost aria-hidden="true"></span>
        <span class="tree__pill" data-pill aria-hidden="true"><span class="tree__sheen" data-sheen></span></span>
        <span class="tree__mark" data-mark aria-hidden="true"></span>

        <section class="grp" data-group>
          <button class="grp__head" type="button" aria-expanded="false" data-head>
            <svg class="grp__chev" viewBox="0 0 12 12" aria-hidden="true" data-chev><path d="M4.6 3 7.6 6l-3 3" /></svg>
            <span class="grp__name">Getting started</span>
            <span class="grp__count">4</span>
          </button>
          <div class="grp__wrap" data-wrap>
            <ul class="grp__list">
              <li><a class="row" href="#overview" data-row><span class="row__face"><span class="row__words">Overview</span></span></a></li>
              <li><a class="row" href="#authentication" data-row><span class="row__face"><span class="row__words">Authentication</span></span></a></li>
              <li><a class="row" href="#errors" data-row><span class="row__face"><span class="row__words">Errors</span></span></a></li>
              <li><a class="row" href="#idempotency" data-row><span class="row__face"><span class="row__words">Idempotent requests</span></span></a></li>
            </ul>
          </div>
        </section>

        <section class="grp" data-group data-open>
          <button class="grp__head" type="button" aria-expanded="true" data-head>
            <svg class="grp__chev" viewBox="0 0 12 12" aria-hidden="true" data-chev><path d="M4.6 3 7.6 6l-3 3" /></svg>
            <span class="grp__name">Payments</span>
            <span class="grp__count">5</span>
          </button>
          <div class="grp__wrap" data-wrap>
            <ul class="grp__list">
              <li><a class="row" href="#create-payment" data-row><span class="row__face"><span class="tag tag--post">POST</span><span class="row__words">Create a payment</span></span></a></li>
              <li><a class="row" href="#retrieve-payment" data-row data-start><span class="row__face"><span class="tag tag--get">GET</span><span class="row__words">Retrieve a payment</span></span></a></li>
              <li><a class="row" href="#list-payments" data-row><span class="row__face"><span class="tag tag--get">GET</span><span class="row__words">List all payments</span></span></a></li>
              <li><a class="row" href="#capture-payment" data-row><span class="row__face"><span class="tag tag--post">POST</span><span class="row__words">Capture a payment</span></span></a></li>
              <li><a class="row" href="#refund-payment" data-row><span class="row__face"><span class="tag tag--post">POST</span><span class="row__words">Refund a payment</span></span></a></li>
            </ul>
          </div>
        </section>

        <section class="grp" data-group>
          <button class="grp__head" type="button" aria-expanded="false" data-head>
            <svg class="grp__chev" viewBox="0 0 12 12" aria-hidden="true" data-chev><path d="M4.6 3 7.6 6l-3 3" /></svg>
            <span class="grp__name">Customers</span>
            <span class="grp__count">3</span>
          </button>
          <div class="grp__wrap" data-wrap>
            <ul class="grp__list">
              <li><a class="row" href="#create-customer" data-row><span class="row__face"><span class="tag tag--post">POST</span><span class="row__words">Create a customer</span></span></a></li>
              <li><a class="row" href="#retrieve-customer" data-row><span class="row__face"><span class="tag tag--get">GET</span><span class="row__words">Retrieve a customer</span></span></a></li>
              <li><a class="row" href="#delete-customer" data-row><span class="row__face"><span class="tag tag--del">DEL</span><span class="row__words">Delete a customer</span></span></a></li>
            </ul>
          </div>
        </section>

        <section class="grp" data-group>
          <button class="grp__head" type="button" aria-expanded="false" data-head>
            <svg class="grp__chev" viewBox="0 0 12 12" aria-hidden="true" data-chev><path d="M4.6 3 7.6 6l-3 3" /></svg>
            <span class="grp__name">Webhooks</span>
            <span class="grp__count">3</span>
          </button>
          <div class="grp__wrap" data-wrap>
            <ul class="grp__list">
              <li><a class="row" href="#create-endpoint" data-row><span class="row__face"><span class="tag tag--post">POST</span><span class="row__words">Create an endpoint</span></span></a></li>
              <li><a class="row" href="#list-events" data-row><span class="row__face"><span class="tag tag--get">GET</span><span class="row__words">List events</span></span></a></li>
              <li><a class="row" href="#delete-endpoint" data-row><span class="row__face"><span class="tag tag--del">DEL</span><span class="row__words">Delete an endpoint</span></span></a></li>
            </ul>
          </div>
        </section>
      </div>
    </nav>

    <!-- the pilot's pointer: shows the sidebar by itself and steps aside for a real hand -->
    <svg class="hand" data-hand viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.2 18.6 13l-6.1.9 3.6 6.6-2.6 1.4-3.6-6.7L5 19.4Z" />
    </svg>
    <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.

59 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 “API docs 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 a white page, alone, the sidebar card of the docs of Ledgerline, an invented payments company: barely warm white, with a one pixel edge, a thread of light on top and a soft layered shadow. At the top the mark with API and the 2026-10 version in a mono face; below it the Search the API field with its drawn key. Then four groups: Getting started, Payments, Customers and Webhooks, each with its chevron and the number of its pages. Payments is open: five endpoints, each with its method in a mono tag (POST indigo, GET green, DEL red), along a thin grey rail. The page you are on, Retrieve a payment, has a pill of very light indigo glass with a lit top edge, its words darker, fuller and two pixels to the right, its tag filled with its colour and next to it, on the rail, an indigo marker two pixels wide with a faint glow. Choosing another page, the marker and the pill go there on two springs: the front edge leaves at once, the back one follows softer, so for a moment the marker covers all the rows in between, then it gathers on the row passing the mark by a pixel; the tag swells and settles, and a sheen runs across the pill. Tapping a closed group its chevron turns with a small bounce, the open group folds away while the new one opens with its rows coming down one after another, and the marker rides the fold and goes down to the first page. With a mouse a grey pill follows the row under the pointer. The card never changes height. A drawn pointer arrow plays the tour by itself: Refund, Create, Webhooks, List events and back to Payments.

How it works

Two springs for two edges

The marker and the pill do not have one position but two numbers, the top edge and the bottom one, each on its own hand written spring (position, speed, stiffness, damping) integrated in steps of 1/120 of a second in a GSAP ticker. On each choice the edge in front of the trip gets the STIFF stiffness and the one behind STIFF times TRAIL: the first gets there sooner, the second chases it, and the marker stretches and gathers by itself.

The row read every frame

The springs do not chase a fixed number but the row: every frame the script reads its distance from the top of the index by adding up the offsetTops to the index (the entrance's transforms do not count) and cuts it to what its group still shows. So if the group folds away the marker squashes and disappears into the fold instead of hanging in the air.

The fold of the groups

Each group is an overflow hidden wrap whose height goes from what it has to scrollHeight or to zero with GSAP. The one closing and the one opening use the same duration and the same curve, so the sum of the two heights never goes past the longest group and the index, as tall as that, never changes size. Once open, the height goes back to auto and follows resizes.

The ticker that switches off

The ticker is on only while something moves (a choice, a fold, a resize) and takes itself off when both springs are still and no group is folding: at rest the page draws nothing.

The details of the arrival

The chosen row gets the is-current class: the words go to weight 590 and move two pixels on a curve that goes a hair past, the method tag fills with its colour and swells with back.out, and a white diagonal sheen crosses the pill. The grey ghost under the pointer moves with two quickTos, and follows it if the list moves.

Values to change

NameFileDefaultWhat it changes
STIFFscript.js420The stiffness of the front edge: higher reaches the row sooner.
TRAILscript.js0.42The back edge as a share of the front one: lower stretches the marker more.
DAMPscript.js0.8The damping of the springs: lower passes the row by more, 1 never passes it.
FOLDscript.js0.5The seconds a group takes to fold open or shut.
ONE_OPENscript.jstrueOpening a group folds the open one away.
FIRST_PAGEscript.jstrueOpening a group takes you to its first page.
PACEscript.js1The pilot's pauses: higher waits longer between moves.
LOOPscript.jstrueThe pilot plays the tour again and again.

Try them in the Playground

When to use it

For the docs site of an API, an SDK or a developer product, for an app's help centre or for any grouped sidebar (the settings of a dashboard, the chapters of a guide): it shows where you are and where you came from without a page change.

On phones

The same animation with adapted sizes: the card is 88% of the screen wide and the row height is sized on the window height too (between 22 and 33 pixels), so the whole sidebar fits the box. A finger taps groups and rows; the grey ghost, which is for the mouse only, does not appear.

With reduced motion

Nothing slides: the marker and the pill appear at once on the chosen row, the groups open and close without a fold with their rows fading, and the pilot's arrow is not shown; the pilot still changes page and group.

Pitfalls

  • The rows sit in a list with position relative (for the rail): a row's offsetTop was measured from there and not from the index. The offsetTops are added up the offsetParents to the index.
  • Removing the data-open attribute before reading the group's height let the CSS drop it to zero at once and the fold did not show: the starting height is read before the state changes.
  • With the opening on expo.out and the closing on power3.inOut, halfway through the swap the two groups together were taller than the index and the card grew and shrank: the same curve and duration for both keep the sum constant.
  • The grey ghost stayed where the row was before the fold: every frame of the springs it reads the hovered row's place again.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

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