Skip to content
animorio
IT
All components

Address autocomplete

Forms, Hover, TextGSAP, CSS onlyMediumCompressed weight: Demo 8.0 KBGSAP 28 KBFreeDownload the zip

The shipping address block of a checkout, on white, in the clean style of real product interface pieces: typing the street brings up suggestions underneath, filtering at every letter with the matched part in bold and a pill sliding onto the chosen one. Pick one with the arrows or a click: the list closes on a spring and City, Postcode and Country fill in one after another, letter by letter, with a flash on the border.

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>
<!--
  "Address autocomplete" 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 address field that fills itself in</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" data-stage>
    <!-- the shipping address block of a checkout: typing in the address field brings up suggestions that filter as you type,
         and choosing one fills City, Postcode and Country one after another, letter by letter, while the list closes on a spring -->
    <section class="ship" data-card aria-label="Shipping address">
      <header class="ship__head">
        <svg class="ship__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 18 12 5l7 13"></path><path d="M8.5 13h7"></path></svg>
        <div>
          <p class="ship__title">Shipping address</p>
          <p class="ship__sub">Quillcrest checkout · delivery in 2–3 days</p>
        </div>
      </header>

      <div class="group" data-group>
        <label class="label" for="addr">Address</label>
        <div class="field field--search" data-field-addr>
          <svg class="field__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="6.2"></circle><path d="m20 20-4.4-4.4"></path></svg>
          <input id="addr" class="field__input" data-addr type="text" autocomplete="off" spellcheck="false"
                 placeholder="Start typing your street" role="combobox" aria-expanded="false" aria-controls="lista" aria-autocomplete="list">
          <span class="field__caret" data-caret aria-hidden="true"></span>
        </div>

        <div class="drop" id="lista" data-drop role="listbox" aria-label="Suggested addresses">
          <span class="drop__load" data-load aria-hidden="true"></span>
          <span class="drop__pill" data-pill aria-hidden="true"></span>
          <ul class="drop__list" data-list></ul>
          <p class="drop__empty" data-empty>No matches. Try a street name.</p>
          <button class="drop__manual" type="button" data-manual>
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h4L19 9l-4-4L4 16Z"></path><path d="m13.5 6.5 4 4"></path></svg>
            Enter manually
          </button>
        </div>
      </div>

      <div class="row">
        <div class="group">
          <label class="label" for="city">City</label>
          <div class="field" data-field="city"><input id="city" class="field__input" data-out="city" type="text" autocomplete="off"></div>
        </div>
      </div>
      <div class="row row--two">
        <div class="group">
          <label class="label" for="post">Postcode</label>
          <div class="field" data-field="post"><input id="post" class="field__input field__input--mono" data-out="post" type="text" autocomplete="off"></div>
        </div>
        <div class="group">
          <label class="label" for="country">Country</label>
          <div class="field" data-field="country"><input id="country" class="field__input" data-out="country" type="text" autocomplete="off"></div>
        </div>
      </div>

      <footer class="ship__foot">
        <p class="ship__note" data-note>We only ship to the address you choose.</p>
        <button class="solidbtn" type="button" data-continue>
          Continue
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h13"></path><path d="m13 6 6 6-6 6"></path></svg>
        </button>
      </footer>
    </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>
  </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.

24 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 “Address autocomplete” 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 very light grey background sits the white «Shipping address» card of the checkout of Quillcrest, an invented shop, with the black mark and the line «delivery in 2–3 days». The first field, Address, has the drawn magnifier and a border that turns indigo with a halo when you touch it. As you type, a dropdown opens under the field on a little spring: a thin loading line runs along its top edge, then the suggestions arrive, at most three, one under the other, each with its drawn map pin, the street with the matched part in bold and the town and country below in grey. At every letter the list filters again. A grey pill sits under the active item and slides with the arrow keys or following the pointer; at the bottom there is «Enter manually» with a pencil. Choosing an item, the dropdown closes with a little dip and rises away, the street stays in the field, and City, Postcode and Country fill in one after another, letter by letter, each with an indigo flash running round its border and a one-pixel hop; the Continue button lights up and the note below says where the parcel will go. A drawn pointer types «12 Har» and picks with the arrow, then «Via de» and picks two items further down, and starts again. It also really works, with keyboard, mouse and touch; the addresses are invented.

How it works

A search that pretends to search

At every letter a gsap.delayedCall of SEARCH_DELAY seconds replaces the previous one: meanwhile a two-pixel gradient line stretches along the top edge of the dropdown. When it fires, the list filters the addresses with includes, keeps at most MAX_RESULTS and writes them with the matched part in a b.

One pill under the active item

The chosen item does not change its background: under the list there is a single grey pill in absolute position, which GSAP moves to the item’s offsetTop with back.out. The arrow keys, the pointer passing over and the autopilot all call the same setActive.

A dropdown that closes on a spring

Opening, the dropdown goes from scaleY 0.92 to 1 with back.out from its top edge; closing, it first dips a pixel and stretches to scaleY 1.015 in eight hundredths of a second, then rises away with power3.in. That small dip is what makes it feel like a spring.

Fields that fill themselves

A timeline places each value FILL_STAGGER seconds after the previous one: an object with n going from zero to the text length writes value.slice(0, n) every frame, while an indigo border over the field goes from opacity 1 to 0 and the input hops two pixels with back.out.

An autopilot that really types

The pilot does not fake the dropdown: it adds a letter to the input and calls the same search function as a real key, and sends keydown ArrowDown and Enter like the keyboard. A drawn caret, measured with a hidden copy of the text, blinks where the typing is. At the first real touch it stops, and it starts again after eight seconds.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#4f5bd5The colour of the active border, the loading line and the flashes on the fields.
SEARCH_DELAYscript.js0.3The seconds the list «searches» before showing the suggestions.
MAX_RESULTSscript.js3How many suggestions the list shows at most.
FILL_STAGGERscript.js0.22The seconds between one field filling in and the next.
LETTER_TIMEscript.js0.035The seconds per letter while the fields fill in.
TYPE_SPEEDscript.js0.11The seconds per letter the autopilot types.
PAUSEscript.js2.4The seconds the autopilot leaves the filled address before starting again.

Try them in the Playground

When to use it

For an online shop’s checkout, a delivery service’s address page, an app’s billing profile or any form where typing a full address is slow: you type a few letters and the rest comes by itself.

On phones

The card takes the screen width minus the margins, fields and rows shorten with vmin so everything fits in height, and the dropdown stays inside the card over the fields below. A tap chooses like a click and opens the real keyboard.

With reduced motion

No springs and no arriving letters: the dropdown fades in and out, the pill jumps to the item, the fields fill in whole with a fade and the drawn pointer stays hidden.

Pitfalls

  • The dropdown sits over the fields below, inside the card: had it left the card, the preview would have cut it, and on a phone it would have fallen below the box’s edge. That is why the list shows at most three items.
  • Without killing the previous letter’s delayedCall, fast typing brought old results after new ones.
  • The autopilot’s drawn caret must be measured with the input’s real font: a hidden copy with the same font gives the exact width of the typed text.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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