Skip to content
animorio
IT
All components

VAT number field

Forms, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.5 KBGSAP 28 KBFreeDownload the zip

The VAT number field of a business checkout: the digits fall into groups, eleven marks count them, and at the eleventh the script tests the check digit. If it is wrong the field shakes in red; if it is right a spinner asks the registry and the company name opens below, in green.

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>
<!--
  "VAT number field" 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>VAT number field</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">
    <!-- a VAT number field for a business checkout: the digits fall into groups, eleven marks count them,
         the check digit is tested as the last one lands and the registry answers with the company -->
    <form class="vf" data-vf novalidate>
      <div class="vf__top">
        <label class="vf__label" for="vat">VAT number</label>
        <span class="vf__hint" aria-live="polite"><span class="vf__roll"><span data-hint>11 digits</span></span></span>
      </div>

      <div class="vf__field" data-field>
        <span class="vf__country" aria-label="Italy">
          <i class="vf__flag" aria-hidden="true"><b></b><b></b><b></b></i>IT
        </span>
        <input class="vf__input" id="vat" data-input type="text" inputmode="numeric" autocomplete="off" spellcheck="false" placeholder="0000 0000 000" maxlength="13" aria-describedby="vat-out">
        <span class="vf__status" aria-hidden="true">
          <svg class="vf__spin" data-spin viewBox="0 0 22 22"><circle cx="11" cy="11" r="8" pathLength="1"></circle></svg>
          <svg class="vf__mark" viewBox="0 0 22 22">
            <path data-tick pathLength="1" d="M5.500 11.400 9.400 15.100 16.600 7.200"></path>
            <path data-cross-a pathLength="1" d="M7 7 15 15"></path>
            <path data-cross-b pathLength="1" d="M15 7 7 15"></path>
          </svg>
        </span>
      </div>

      <div class="vf__marks" data-marks aria-hidden="true"></div>

      <div class="vf__out" id="vat-out" data-out>
        <div class="vf__company" data-company>
          <span class="vf__tile" aria-hidden="true">LS</span>
          <span class="vf__who">
            <b>Lumen Studio S.r.l.</b>
            <span>Via dei Mille 12, Torino</span>
          </span>
          <span class="vf__pill">Active</span>
        </div>
      </div>
    </form>

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

19 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 “VAT number field” 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 white, a single field: above it “VAT number” and on the right “11 digits”; inside, the country chip with the flag and “IT”, then the digits, which fall into groups of four, four and three as you type. Under the field eleven thin marks fill one per digit, on a small spring. At the eleventh digit the script works out the Italian VAT check digit. If it does not match, the field shakes sideways, border, marks and label turn red, a cross draws itself on the right and the label rolls to “Check digit doesn’t match”. With the last digit fixed, the field is blue again, a spinner turns on the right while the label says “Checking the registry”, then everything turns green: the spinner gives way to a drawn check, the label says “Verified” and the company card springs open below, with initials, business name, address and the “Active” pill. Change a digit and the card closes.

How it works

The check digit, at once

The eleventh digit of an Italian VAT number is a Luhn sum over the first ten: it is tested in the browser, calling no one, and the error comes the instant you finish typing.

One state, one colour

Empty, typing, checking, right, wrong: the state is one word, and its colour lives in --tone. Border, halo, marks, spinner, check and label all read it.

The spinner on its centre

The whole svg turns with transformOrigin at 50% 50%: the circle spins on itself and not round a far point. The answer opens the card by animating the height to the measured one.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#3157ffThe field’s colour while typing.
GOODscript.js#159a5cThe colour of a verified VAT number.
BADscript.js#d8452eThe colour of a wrong check digit.
BASEscript.js0482915073The first ten digits of the demo’s VAT number: the script works out the eleventh.
TYPEscript.js0.13The seconds between digits when the demo types by itself.
CHECKscript.js1.3How many seconds the fake registry check lasts.
HOLDscript.js3The seconds the result stays before the demo starts again.
LOOPscript.jstrueLeft alone, the field types itself: it gets the last digit wrong, fixes it and verifies.

Try them in the Playground

When to use it

In the checkout of a shop that also sells to businesses, in the signup of a service for professionals, on the billing details page; and for any code with a check digit: IBAN, tax code, card number.

On phones

The same field, as wide as the screen, with the numeric keyboard. The demo never focuses the field by itself, so the keyboard does not open until you tap it.

With reduced motion

Marks, colours and labels change without motion: the field does not shake, the spinner stays still and the company card appears already open.

Pitfalls

  • The demo’s VAT number is made up (its check digit is computed, but it belongs to no real company) and so is the company. The registry check is fake: a real one calls a service such as the European VIES, from the server.
  • The check digit only says the number is well written, not that the company exists: that is why the registry check follows, and the two errors need different words.
  • The status label is in an aria-live region and the field has aria-invalid when the digit does not match: the error is not told by red alone.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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