Skip to content
animorio
IT
All components

Confirm password field

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

The «Confirm password» field of a sign-up, under the new password one: every dot you type drops under its twin above and, if the character is the same, a thin thread stitches them while the dot above dips by a hair, pulled. A wrong character lands hollow, shakes, and its thread is left hanging and swinging; when the two passwords are the same the threads take the accent colour from the left and a tick draws itself at the end of the field.

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>
<!--
  "Confirm password 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 confirm password field with the dots stitching together</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">
    <!-- two password fields, one above the other: every dot typed in the second one drops under its twin in the
         first, and a thin stitch joins them when the two characters are the same -->
    <div class="pair" data-pair>
      <div class="fld" data-fld="a">
        <label class="fld__cap" for="pw-new">New password</label>
        <input class="fld__input" id="pw-new" type="password" autocomplete="new-password" spellcheck="false" autocapitalize="off" autocorrect="off" data-input>
        <div class="fld__row" aria-hidden="true" data-row><span class="caret" data-caret></span></div>
      </div>
      <div class="rungs" aria-hidden="true" data-rungs></div>
      <div class="fld" data-fld="b">
        <label class="fld__cap" for="pw-again">Confirm password</label>
        <input class="fld__input" id="pw-again" type="password" autocomplete="new-password" spellcheck="false" autocapitalize="off" autocorrect="off" aria-describedby="pw-note" data-input>
        <div class="fld__row" aria-hidden="true" data-row><span class="caret" data-caret></span></div>
        <svg class="fld__tick" viewBox="0 0 24 24" aria-hidden="true"><path data-tick d="M6.5 12.6 10.4 16.4 17.6 8.4"/></svg>
      </div>
      <p class="note" id="pw-note" aria-live="polite"><span class="note__clip"><span class="note__word" data-note>Type it once more</span></span></p>
    </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.

16 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 “Confirm password 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, alone in the middle, two light fields with a thin edge one above the other: New password, holding the dots of a password already typed, and Confirm password, empty, with the grey line Type it once more under it. Between the two fields there is an empty strip. Typing in the second field each dot drops from above with a small bounce and lands exactly under the dot of the first field in the same place. If the character is the same, in the strip between the fields a thin grey thread draws itself from top to bottom between the two dots, and the dot above dips by a hair and comes back on a spring, as if pulled by the thread; the line under says So far so good. If the character is different the dot lands hollow, a ring, shakes sideways and settles; its thread stops a third of the way, hanging from the dot above, and swings until it stops; the line under becomes That one doesn’t match. Deleting, the dot rises and goes and the thread pulls back. When the second password is the same as the first, the threads turn blue one after the other from the left, each one thickening for a moment, the dots below give a little hop, a blue tick draws itself at the end of the field, going a pixel too far and settling, and the line under turns blue: Passwords match. Each new line comes in from below, narrow, and opens up on the width axis. Tapped, a field gives by a breath and takes a blue edge with a halo, and the blue caret blinks after the last dot. Until someone touches it the field types by itself: it gets a letter wrong, deletes it, finishes, and after a while starts again.

How it works

Two real fields under the dots

Underneath are two real password inputs (autocomplete new-password, labels, aria-describedby to the line under, which is aria-live): keyboard, pasting and password managers work by themselves. The input’s text and caret are transparent; the script reads the value on every input and draws one dot per character, in a row with a fixed pitch, the same in both fields. So the dot below is always in a column with its twin above, with nothing to measure.

Place by place

Each place is empty, the same or different. On every key the two passwords are compared character by character and only the place whose state has changed is animated: a thread stitching, one left hanging, one pulling back. The comparison is never shown in writing: only the dots and the threads are seen.

The thread and the spring

The thread is a one-pixel line growing with scaleY from the top in power3.out; a moment later the dot above drops by 1.2 pixels and comes back with elastic.out, and that is what sells the pull. The wrong thread stops at a third and swings on rotation keyframes that die down: 26, minus 14, 7, minus 3, zero.

The end

When the passwords are the same the threads change colour one after the other, 35 milliseconds apart, each widening on scaleX and coming back, and the tick draws with strokeDashoffset to minus 0.8, a pixel past the end, and back to zero. The line under comes in with the wdth axis from 78 to 100 on back.out, after the old one has left upwards.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#3a5cffThe colour of the focused edge, the caret, the threads once everything matches and the tick.
PASSWORDscript.jsharbor-1847The password already in the first field.
TYPO_ATscript.js4The character where the field slips when it types by itself.
PITCHscript.js14The pixels from one dot to the next.
SPRINGscript.js1How springy the dots are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2.4How many seconds the matching password stays before the field types again by itself.
AUTOscript.jstrueThe field types by itself until someone touches it.

Try them in the Playground

When to use it

When signing up to a site or an app, changing a password, accepting an invite to an account: anywhere the password has to be typed twice and it helps to show where it differs without showing it.

On phones

The fields take the width of the screen up to 340 pixels; a tap opens the phone’s keyboard. There is no hover, everything else is the same.

With reduced motion

The dots, the threads, the tick and the lines fade in and out in place, with no drops, springs or swinging; the caret does not blink.

Pitfalls

  • The dots have a fixed pitch and do not follow the letters’ widths: that is what keeps them in a column between the two fields. So the real caret has to stay at the end (setSelectionRange on every touch and the arrows blocked), otherwise typing would go in the middle with the drawn caret at the end.
  • The dot has two elements: GSAP moves the span (drop, shake, hop), the CSS colours the child (full or ring); with a single element GSAP’s transform and the colour transition step on each other.
  • A thread only animates when its place changes state: redrawing all the threads on every key would restart them all from zero together.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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