Skip to content
animorio
IT
All components

Inbox tabs

Tabs, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

The inbox tabs of Halyard, an invented mail app, in a dark glass card like a Dribbble shot: Primary, Updates and Mentions, each with its unread counter. Pick a tab and the glass pill jumps onto it on two springs, the leading edge pulled harder than the trailing one, so it stretches while it travels and gets a little thinner; the messages come in from the side you are heading to. Then they are read one at a time: the sender loses its bold, the counter rolls down a digit and at zero folds back into the tab, and the footer reads All caught up with a check that draws itself. Meanwhile new mail lands in the other tabs: their counter pops back out with a bounce and the sync icon turns once.

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>
<!--
  "Inbox tabs" 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 inbox tabs with unread counters that drain</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 inbox of Halyard, an invented mail app: three tabs with their unread counters. The glass pill springs to the
         tab you pick and stretches while it travels, the messages slide in from the side you are going, then they are
         read one by one and the counter rolls down to zero and folds away. Mail keeps arriving in the other tabs. -->
    <section class="mail" data-mail aria-labelledby="mail-title">
      <span class="mail__glow" data-glow aria-hidden="true"></span>
      <header class="mail__head">
        <span class="mail__mark" aria-hidden="true">
          <svg viewBox="0 0 20 20"><path d="M3 6.2 10 11l7-4.8"/><rect x="2.6" y="4.4" width="14.8" height="11.2" rx="2.6"/></svg>
        </span>
        <span class="mail__titles">
          <span class="mail__app">Halyard</span>
          <span class="mail__title" id="mail-title">Inbox</span>
        </span>
        <span class="mail__me" aria-hidden="true">LV</span>
      </header>

      <div class="tabs" role="tablist" aria-label="Mailboxes" data-tabs>
        <span class="tabs__pill" data-pill aria-hidden="true"><span class="tabs__shine"></span></span>
        <button class="tab" role="tab" type="button" data-tab="primary"><span class="tab__label">Primary</span><span class="badge" data-badge aria-hidden="true"><span class="badge__in"><span class="badge__col" data-col></span></span></span></button>
        <button class="tab" role="tab" type="button" data-tab="updates"><span class="tab__label">Updates</span><span class="badge" data-badge aria-hidden="true"><span class="badge__in"><span class="badge__col" data-col></span></span></span></button>
        <button class="tab" role="tab" type="button" data-tab="mentions"><span class="tab__label">Mentions</span><span class="badge" data-badge aria-hidden="true"><span class="badge__in"><span class="badge__col" data-col></span></span></span></button>
      </div>

      <div class="list" role="tabpanel" data-list aria-live="off"></div>

      <footer class="mail__foot">
        <span class="foot__state" data-state>
          <span class="foot__line" data-line-a></span>
          <span class="foot__line foot__line--b" data-line-b></span>
        </span>
        <span class="foot__sync" aria-hidden="true">
          <svg viewBox="0 0 20 20" data-sync><path d="M15.5 8.2A5.8 5.8 0 0 0 4.7 7"/><path d="M4.5 3.8v3.4h3.4"/><path d="M4.5 11.8a5.8 5.8 0 0 0 10.8 1.2"/><path d="M15.5 16.2v-3.4h-3.4"/></svg>
        </span>
      </footer>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5 18.6 12l-6 1.4-3.2 5.6z"/></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.

25 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 “Inbox tabs” 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 black background sits a dark card with soft corners, a one pixel border, a light at the top and a periwinkle glow that follows the chosen tab. At the top the app icon, Halyard and Inbox, and the reader's initials in a circle. Below, a bar with three tabs, Primary, Updates and Mentions, each with its periwinkle counter; below that four rows of mail with the coloured initials, the sender, the subject and the time, the unread ones in bold with the time in periwinkle. At the bottom a line saying how many are unread, or All caught up with a check, and the sync icon. A drawn pointer opens the tabs one after the other while new mail arrives.

How it works

The pill on two springs

The glass pill has no animated position and width: it has two edges, each with its own hand-written damped spring integrated in GSAP's ticker in four half steps. The edge you are heading to is pulled by STIFFNESS, the trailing one by STIFFNESS times STRETCH: the first leaves earlier, the second chases it, and the pill stretches on the way and shortens on arrival with a small bounce. The target is read from the tabs on every frame, so it also follows the counter folding away and changing the tab's width. With speed the pill gets thinner (SQUASH) and a light crosses it when it lands.

Messages from the right side

Changing tab, the old rows leave by SLIDE pixels on the opposite side and the new ones come in from the side you are heading to, STAGGER seconds apart. The list has the fixed height of four rows, measured on the screen height too, so the card does not jump.

Reading and the rolling counter

READ_DELAY seconds after opening, the first unread message is read: the sender loses its bold with a transition of the variable font weight, the time turns grey and the row lights up for a moment. The counter is a column of digits from 0 to 9 inside a pill: it goes down a digit in ROLL seconds with a small overshoot. At zero it rolls to 0 and the pill folds into the tab, narrowing and shrinking; the footer turns to All caught up with a check that draws itself.

Mail arriving

In the tabs you are not looking at, new messages arrive from a short list: the counter, if it was closed, pops back out widening with a bounce, otherwise it goes up a digit and swells for a moment on an elastic spring, and the sync icon turns once. The drawn pointer then opens that very tab; when the real pointer arrives it stops and mail keeps arriving now and then.

Values to change

NameFileDefaultWhat it changes
STIFFNESSscript.js380The spring pulling the leading edge of the pill: higher is snappier.
STRETCHscript.js0.5How hard the trailing edge is pulled compared with the leading one: lower stretches the pill more while it travels.
DAMPINGscript.js26How quickly the spring settles: lower overshoots and wobbles more.
SQUASHscript.js0.12How much thinner the pill gets at full speed.
READ_DELAYscript.js1.2Seconds between opening the tab and the first message being read.
READ_STEPscript.js0.65Seconds between two messages being read.
SLIDEscript.js26Pixels the messages travel when the tab changes.
STAGGERscript.js0.05Seconds between two messages sliding in.
ROLLscript.js0.45Seconds for the counter to roll to the next digit.
LOOPscript.jstrueLeft alone, a drawn pointer keeps reading the mail.

Try them in the Playground

When to use it

In an app's mail, in a back office's notifications, in the messages of a marketplace or a freelance platform, in a help desk's tickets: wherever tabs have something new to count and the number must go down while you read.

On phones

The same animation with adapted sizes: the card is almost as wide as the screen, rows, headings and the tab bar are sized on the height too, so everything fits in the phone box. Tabs are tapped with a finger.

With reduced motion

Nothing moves: the pill goes straight to the tab, the messages and the footer change with a fade, the counter changes digit in place and opens and closes with a fade, and there is no drawn pointer.

Pitfalls

  • A single pill tweened in position and width does not stretch: the effect needs two edges with two different springs.
  • The counter folding away changes the tab's width: that is why the pill's target is read on every frame, not only on click.
  • New mail in the open tab moved the rows under the finger: it only lands in the tabs you are not looking at.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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