Skip to content
animorio
IT
All components

Username availability field

Forms, Text, SVGGSAP, CSS onlyMediumCompressed weight: Demo 8.9 KBGSAP 28 KBFreeDownload the zip

The Username field of a made-up app’s sign up, alone on white in a premium minimal style: with the @ prefix and a rolling counter, after a short pause in typing a thin arc checks the name. If it is free a check draws itself and the line says in green that it is available; if it is taken the field gives a little sideways no, the edge turns thin red and three suggestions come in staggered below, ready to tap, rewriting the field letter by letter. Characters that are not allowed jump out of the caret and fade.

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>
<!--
  "Username availability 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>The username field that checks if the name is free</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 username field of a made-up app's sign up: after a short pause a thin arc checks the name, then either a
         drawn check and a green line, or a little sideways no, a thin red edge and three suggestions to tap -->
    <div class="user" data-user>
      <div class="user__top">
        <label class="user__label" for="u-name">Username</label>
        <span class="count" data-count aria-hidden="true">
          <span class="count__digits"><span class="roll roll--tens" data-tens><span class="roll__col" data-tenscol></span></span><span class="roll" data-units><span class="roll__col" data-unitscol></span></span></span><span class="count__max">/<span data-max>20</span></span>
        </span>
      </div>

      <div class="field" data-field>
        <span class="field__ring" aria-hidden="true"></span>
        <span class="field__at" aria-hidden="true">@</span>
        <span class="field__box" data-box>
          <input class="field__input" id="u-name" data-input type="text" autocomplete="username" autocapitalize="none"
                 autocorrect="off" spellcheck="false" inputmode="text" placeholder="yourname"
                 aria-describedby="u-status u-count" aria-invalid="false">
          <span class="field__measure" data-measure aria-hidden="true"></span>
          <span class="bumps" data-bumps aria-hidden="true"></span>
        </span>
        <span class="slot" aria-hidden="true">
          <svg class="slot__spin" data-spin viewBox="0 0 20 20"><circle class="slot__track" cx="10" cy="10" r="7.25"></circle><circle class="slot__arc" data-arc cx="10" cy="10" r="7.25"></circle></svg>
          <svg class="slot__ok" data-ok viewBox="0 0 20 20"><circle class="slot__okbg" data-okbg cx="10" cy="10" r="9"></circle><path data-okpath d="M6.2 10.3 8.8 12.9 13.9 7.4"></path></svg>
          <svg class="slot__no" data-no viewBox="0 0 20 20"><path data-nopath d="M7 7 13 13M13 7 7 13"></path></svg>
        </span>
      </div>

      <p class="status" id="u-status" data-status aria-live="polite"><span class="status__line" data-line>Letters, numbers, dots and underscores.</span></p>
      <p class="sr" id="u-count" data-countsr>0 of 20 characters</p>

      <div class="sugg" data-sugg role="group" aria-label="Free usernames you can use"></div>
    </div>

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

22 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 “Username availability 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 a white background there is just the username field of a sign up: above it the Username label and on the right the 0/20 counter, below it the fifty-six pixel field with soft corners, a one pixel edge, a thread of light along the top and a very light shadow, the grey at sign in front and the line Letters, numbers, dots and underscores. On hover the edge darkens, touched it gets a soft ring around it and the at sign turns black. While typing the counter digits roll with a small bounce and the tens column opens up when you pass nine; capitals turn lowercase on their own, and a character that is not allowed, a space or an exclamation mark, jumps out of the caret in red with a slight turn and fades, while the typed name flinches by a pixel and a half; at twenty letters it is the counter that jolts in red. After a short pause a thin arc appears on the right, turning while it grows and shrinks, and the line below rises into Checking @mara.lund. If the name is free the arc leaves, a green circle swells with a bounce and a check draws inside it, the edge takes a soft green and the line says @mara.lund is available. If it is taken the field gives a little sideways no, a red cross draws itself, the edge turns thin red with a halo, the line says @mara.lund is taken and three pills come in staggered below on a spring: @mara.lund2, @maralund and @mara.studio. Tap a pill and it squeezes and lights up, the others leave, and the field rewrites itself letter by letter: it deletes back to the shared part and types the rest, then checks again. A drawn pointer types a taken name on its own, with a refused space, picks a suggestion, then clears the field and types a free name.

How it works

The character filter

Every input event rereads the value: letters go lowercase, only letters, numbers, dot and underscore stay and never more than MAX_LENGTH. The first refused character is kept with its position, the clean value goes back into the field and the caret stays where it was, counted on the kept characters.

The jump of the refused character

An invisible span in the same type measures the width of the text up to the refused spot, minus the field’s scroll: a red span with the character is born there (the space gets a small bar below so it can be seen) and rises, turns a few degrees and fades, while the text flinches in x with keyframes.

The pause and the check

Every change kills the pending delayedCalls and makes a new one of PAUSE seconds: only when typing stops does the arc start, an SVG circle with a stroke-dasharray as long as its circumference, turning with rotation and breathing through stroke-dashoffset on a yoyo. After CHECK_TIME the name is looked up in the TAKEN list.

The rolling counter

Units and tens are two columns of digits in a one line window with a faded mask above and below; GSAP moves each column in yPercent with back.out. The units have an eleventh zero at the bottom: going up from nine to zero the column runs on to it and then quietly jumps back to zero, so it never rewinds.

The no and the suggestions

The field is the GSAP element and shakes x on damped keyframes, while the red edge is just a class with a CSS transition. The pills are real buttons built from the parts of the name; the button enters with GSAP, its inner face keeps hover and press in CSS. Once a pill is picked, a timeline deletes back to the shared prefix and types the rest.

Values to change

NameFileDefaultWhat it changes
MAX_LENGTHscript.js20The most letters allowed, the number after the counter’s slash.
MIN_LENGTHscript.js3Below this many letters the name is not checked.
PAUSEscript.js0.55How many seconds of pause in typing before the check starts.
CHECK_TIMEscript.js0.9How many seconds the arc turns before the answer.
TAKENscript.jsmara.lund, mara, admin, support, peltoThe names already taken, separated by commas.
SHAKEscript.js6How many pixels the field moves in its no.
TYPE_SPEEDscript.js0.07How many seconds for each letter when a suggestion rewrites the field.

Try them in the Playground

When to use it

In the sign up of a social network, a community, a messaging app or a personal profile site, in the change of username in the account settings, in an onboarding: wherever the name must be unique and it pays to say so at once, before Continue is pressed.

On phones

The field narrows to the screen width minus thirty-two pixels and drops to fifty-two in height, the pills get narrower and stay on one row; the text is sixteen pixels so iOS does not zoom the page on tap, and the keyboard neither corrects nor capitalises.

With reduced motion

No shakes, jumps or rolls: the refused character appears in place and fades, the arc stays still, the check and the cross appear already drawn, the digits change at once, lines and pills fade in and a picked suggestion fills the field all at once. The drawn pointer is not shown, the demo still loops.

Pitfalls

  • Putting the clean value back in the field threw the caret to the end: its position is recounted on the kept characters before it and restored with setSelectionRange.
  • The counter’s units, from 9 to 10, rewound the whole column backwards: an eleventh zero at the bottom of the column lets the digit roll on and then puts it back on top unseen.
  • The pills keep hover and press in CSS, but GSAP brings them in with y and scale and its transform wiped the class one: the button belongs to GSAP, its inner face to the CSS.
  • Every change of the text cancels the running check: without it, a check started for mara.lun arrived later and said available while another name was already in the field. The answer is also dropped if the name is no longer the one checked.
  • The autopilot finds the pills again on every loop with repeatRefresh: the pills are born and die with every taken name, and a position worked out only once pointed at nothing.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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