Skip to content
animorio
IT
All components

Export format button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.7 KBGSAP 28 KBFreeDownload the zip

The toolbar of an invoices table, on white, with a split Export CSV button and its little arrow. The arrow opens the formats, CSV, XLSX, PDF and JSON, with file icons and an estimated size, and a grey bar slides under the hovered option; once a format is picked, only the letters that change roll in the label. Pressed, the button becomes its own progress bar with the percentage, then green with Downloaded, a check drawing itself and a small file falling out.

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>
<!--
  "Export format button" 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 export button with a format picker</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 toolbar of a table, on white: a split Export button. The arrow opens the formats, the choice rolls into the
         label, and a press turns the button into its own progress bar, then into Downloaded with a file dropping out -->
    <section class="card" data-card aria-label="Invoices table">
      <header class="bar">
        <div class="bar__title">
          <p class="bar__name">Invoices</p>
          <p class="bar__meta"><span class="num">248</span> rows <span class="bar__sep">·</span> Q3 2026</p>
        </div>

        <div class="split" data-split>
          <button class="split__main" type="button" data-main aria-live="polite">
            <span class="split__fill" data-fill aria-hidden="true"></span>
            <span class="split__in">
              <svg class="split__icon" data-icon viewBox="0 0 20 20" aria-hidden="true"><path d="M10 3.5v9M6.2 9 10 12.8 13.8 9M4 15.5h12"></path></svg>
              <svg class="split__check" data-check viewBox="0 0 20 20" aria-hidden="true"><path d="M4.6 10.4 8.3 14l7.1-8" pathLength="1"></path></svg>
              <span class="split__label" data-label></span>
              <span class="split__pct num" data-pct></span>
            </span>
          </button>
          <button class="split__more" type="button" data-more aria-haspopup="listbox" aria-expanded="false" aria-label="Choose a format">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M6 8.2 10 12l4-3.8"></path></svg>
          </button>
          <svg class="drop" data-drop viewBox="0 0 24 28" aria-hidden="true"><path d="M5 2.5h9.5L20 8v16.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-21a1 1 0 0 1 1-1Z"></path><path d="M14.5 2.5V8H20"></path></svg>

          <div class="menu" data-menu role="listbox" aria-label="Export format">
            <span class="menu__hl" data-hl aria-hidden="true"></span>
          </div>
        </div>
      </header>

      <div class="rows" aria-hidden="true">
        <div class="row"><span class="num">INV-2041</span><span>Harrow &amp; Pike</span><span class="row__tag">Paid</span><span class="num row__amt">$1,840.00</span></div>
        <div class="row"><span class="num">INV-2040</span><span>Oakfield Supply</span><span class="row__tag">Due</span><span class="num row__amt">$620.50</span></div>
        <div class="row"><span class="num">INV-2039</span><span>Mirelle Studio</span><span class="row__tag">Paid</span><span class="num row__amt">$3,215.00</span></div>
        <div class="row"><span class="num">INV-2038</span><span>Brisk Lane Freight</span><span class="row__tag">Draft</span><span class="num row__amt">$905.75</span></div>
      </div>
    </section>

    <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>
    <span class="measure" data-measure aria-hidden="true"></span>
  </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.

38 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 “Export format button” 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 background there is the card of a table: at the top Invoices, 248 rows from the third quarter, and on the right a dark button split in two, Export CSV with a download arrow and next to it a narrow part with a little arrow; below, four quiet invoices with number, client, status and amount. The little arrow opens a white menu with four formats, CSV, XLSX, PDF and JSON, each with the file icon drawn in line with its letters inside, a line saying what it is for and an estimated size; the options come in staggered and a soft grey bar slides under the hovered one, while the chosen one has its check. Once a format is picked the menu closes and only the letters that change roll in the label, CSV becoming PDF, while Export stays still; the button widens or narrows on a short spring. Pressed, the label becomes Exporting with the percentage in tabular figures and the button fills from the left like a progress bar, quick at first, slower in the middle like a real server, fast at the end; meanwhile the little arrow dims. Then the button turns dark green, the check draws itself with a small snap, the label becomes Downloaded and a small file falls out of the button, tilting and fading; a moment later everything goes back to how it was. A drawn pointer runs the whole loop on its own, picking the next format each time.

How it works

A button in two parts

The button is two buttons side by side with one pixel between them: the wide one exports, the narrow one opens the menu and carries aria-expanded. The outer corners are round and the inner ones square, so from a distance it reads as a single piece.

The menu with a sliding bar

The options are built from a list of formats. A single grey bar sits behind them and GSAP takes it to the offsetTop of the option under the pointer in 0.28 seconds with power3.out: it does not light one option at a time, it slides. The menu opens with back.out from 0.96 and the options come in 3 hundredths apart.

Only the changed letters roll

The label is a group of spans, one per letter. When it changes, the letters shared at the start (Export and the space) stay put, and only the others leave upwards and come back from below 16 milliseconds apart. The width is measured on a hidden span and the button gets there with back.out.

The progress bar inside the button

The fill is a span behind the label with its transform-origin on the left; an object p goes from 0 to 1 in three timeline legs (fast, almost still, fast) and on each update writes scaleX and the percentage. At the end the background turns green with a colour tween and the check, with pathLength 1, draws itself.

The falling file and the autopilot

The file is a small SVG under the button that drops a few pixels, appears, then falls and tilts as it fades, with GSAP keyframes. The autopilot is a timeline that opens the menu, goes down option by option to the next format, picks it and exports; the first real gesture stops it.

Values to change

NameFileDefaultWhat it changes
START_FORMATscript.js"CSV"The format chosen at the start: CSV, XLSX, PDF or JSON.
EXPORT_TIMEscript.js1.8The seconds the file takes to get ready.
DONE_HOLDscript.js1.6The seconds it stays green with Downloaded before going back.
SPRINGscript.js1How much the button’s width bounces when it changes (0 = none).
MENU_SPEEDscript.js1How quickly the format menu opens and closes.
LETTER_STAGGERscript.js0.016The seconds between one letter and the next as the label rolls.

Try them in the Playground

When to use it

For the toolbar of a table or a report in a back office, a dashboard or a team app: picking the format and downloading live in the same button, and whoever waits sees how far along it is without another window.

On phones

The same animation: the card narrows to the screen width, the status column hides and the menu stays inside the box; a tap does the hover, the choice and the download.

With reduced motion

No rolling letters and no spring: labels change with a fade, the menu appears without moving, the fill fades in instead of stretching, the check is already drawn and the file does not fall.

Pitfalls

  • The letters shared by the old and new label must be hidden in the old one, not removed: if the old one vanished all at once, Export would flicker at every format change.
  • The width is measured after document.fonts.ready and with the button’s own weight: measured with the fallback font, the label overflowed the button.
  • The menu’s grey bar moves to the option’s offsetTop, not to its position on screen: the menu is still opening with a scale, and on-screen measurements would be wrong.
  • The little arrow is disabled while exporting: a click on the menu halfway through would change the format of a file that is already being prepared.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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