Skip to content
animorio
IT
All components

One-line upload loader

Loading, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

An app’s file upload, clean as in a real product: a dashed «Drop files or browse» zone that lights up and swells a touch when a file arrives over it, then folds into a single row with the file type icon, the name, the megabytes growing, the speed, the time left and a thin bar. When it is done the row turns green, the tick draws itself and it slides into the list below; the second file drops out halfway, Retry, and it carries on from where it stopped.

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>
<!--
  "One-line upload loader" 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 one-line file upload loader</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">
    <!-- an upload card: the dashed drop zone lights up under a dragged file, folds into a single progress row,
         and the finished row slides into the list below -->
    <section class="card" data-card aria-label="File upload">
      <header class="card__head">
        <div>
          <h1 class="card__title">Upload files</h1>
          <p class="card__sub">PDF, PNG or MP4, up to 50 MB each</p>
        </div>
        <span class="card__count" data-count>No files yet</span>
      </header>

      <div class="slot" data-slot>
        <label class="zone" data-zone>
          <input class="zone__input" type="file" multiple data-input aria-label="Choose files to upload">
          <svg class="zone__border" aria-hidden="true"><rect data-rect></rect></svg>
          <span class="zone__icon" data-zicon>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17.5h-.6a4.4 4.4 0 0 1-.6-8.75 6 6 0 0 1 11.6-1.3A4.9 4.9 0 0 1 17 17.5"></path><path d="M12 20v-8.2M8.8 14.6 12 11.4l3.2 3.2"></path></svg>
          </span>
          <span class="zone__text" data-ztext>Drop files or <b>browse</b></span>
          <span class="zone__hint" data-zhint>Max 50 MB per file</span>
        </label>
      </div>

      <ul class="list" data-list aria-live="polite"></ul>

      <footer class="card__foot">
        <span>Storage</span>
        <span class="meter"><i data-meter></i></span>
        <span class="card__used" data-used>3.2 GB of 10 GB</span>
      </footer>
    </section>

    <div class="ghost" data-ghost aria-hidden="true">
      <div class="chip" data-chip>
        <span class="chip__icon" data-chip-icon></span>
        <span class="chip__name" data-chip-name></span>
      </div>
      <svg class="ghost__arrow" viewBox="0 0 24 24"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
    </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.

28 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 “One-line upload loader” 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 Upload files card with PDF, PNG or MP4, up to 50 MB each in grey and the file count on the right. Below, a light zone with a dashed border that crawls slowly, a cloud with an arrow in a small tile and Drop files or browse. A pointer arrives dragging a file, a white pill with the red PDF icon and the name brand-deck-q4.pdf: as soon as it is over the zone, the zone turns lilac, the dashes turn indigo and run faster, the icon tile lifts a pixel and the text says Release to upload. Once the file is dropped the zone folds into a single row: the file type icon with its label, the name, the percentage, a thin bar filling up, the megabytes growing and on the right the speed and the seconds left, slowing down and speeding up with the curve of the upload; there is also the cross to cancel. When it is done the row turns pale green, the tick draws itself with a snap, and the row slides into the list below while the zone opens again; at the top the count becomes 1 file and the storage bar at the bottom grows. Then a video arrives, launch-teaser.mp4: halfway the connection drops, the row turns pink, shakes sideways and shows Connection lost with a Retry button; the pointer presses it and the upload carries on from where it stopped until the tick. After a pause the list clears and the loop starts again.

How it works

A zone and a row in the same place

The zone and the upload row sit on top of each other in a slot; GSAP takes the slot’s height from the zone’s (a clamp with vh) to the row’s, while the zone fades and the row comes in with back.out. When it is done the height is released and the zone lights up again.

The crawling dashes

The border is an SVG rect drawn to the zone’s real size and redrawn on resize, with stroke-dasharray 6 6; a GSAP ticker moves stroke-dashoffset at a speed that goes from 8 to 34 when a file is over it.

Real speed and time

An object p goes from 0 to 1 on a sine.inOut curve; on every update the speed comes from how much p grew in the last frame, smoothed, and the time left is what remains divided by the speed: the numbers slow down and speed up with the bar.

The row going into the list

At the end the row is measured, moved to the top of the list and started from where it was with a FLIP (the x and y difference to zero in 0.6 seconds); the rows already there move down by its height at the same time.

Real files and the autopilot

It is a real file input inside a label: you can drag a file from your computer or pick one, and the upload is simulated with its size. The autopilot drags two files, stops the second at FAIL_AT and presses Retry; at the first touch or key it stops.

Values to change

NameFileDefaultWhat it changes
FILE_ONEscript.jsbrand-deck-q4.pdfThe first file the autopilot drags.
SIZE_ONEscript.js8.1How big the first file is, in MB.
FILE_TWOscript.jslaunch-teaser.mp4The second file, the one that drops out halfway.
SIZE_TWOscript.js24.6How big the second file is, in MB.
FAIL_ATscript.js0.46Where the second file drops out (0 to 1).
UPLOAD_SPEEDscript.js1How fast the upload is (1 = about 3 MB a second).
ACCENTscript.js#4f46e5The colour of the lit zone and the bar.

Try them in the Playground

When to use it

For file uploads in an app or a dashboard: attachments, documents for a client, videos to publish, profile photos, handing in a piece of work; and for any form that asks for a file.

On phones

The card takes the width minus the margins, the zone gets lower with the screen height and the rows drop to 54 pixels; tapping the zone opens the phone’s file picker. The same animations, with adapted sizes.

With reduced motion

The dashes stay still and nothing moves: the zone and the row swap with a fade, the bar fills, the finished row appears in the list without sliding and the tick is already drawn.

Pitfalls

  • The border rect must be drawn to the zone’s real size (and on resize): with width and height at 100% the stroke sticks out half a pixel and the corners get clipped.
  • The displayed speed must be smoothed: taken frame by frame it jumps all the time and the seconds left become unreadable.
  • For the FLIP the row is measured before and after moving it into the list, in the same frame; moving it before measuring makes it jump to the top.
  • The hidden file input must stay inside the label and focusable: with display none the zone cannot be opened from the keyboard.

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