Skip to content
animorio
IT
All components

Two-step quote button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 7.5 KBGSAP 28 KBFreeDownload the zip

The «Request a quote» button of a made-up garage, Wrenfield Garage, that does not open a new page: it opens inside itself. Pressed, it squashes and widens into the first step, what the car needs (Service, Brakes, Tyres), with a cream mark sliding under the one you point at; pick one and it stretches across the card for the second step, the email, while two thin bars above fill one per step. Sent, the arrow turns into a spinner, the pill closes on «Quote on its way» with a tick that draws itself, a drawn envelope takes off and flies away and a green glow wakes under the card. A wrong email makes the pill shake.

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>
<!--
  "Two-step quote button" 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 request a quote button with a two-step form inside the pill</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">
    <!-- Wrenfield Garage, an invented workshop: «Request a quote» opens inside the pill into the service, then the email,
         and closes on «Quote on its way» while a drawn envelope leaves the pill -->
    <section class="card" aria-labelledby="card-title">
      <span class="card__glow" data-glow aria-hidden="true"></span>
      <header class="card__head">
        <span class="card__mark" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M14.6 6.2a4 4 0 0 0-5.3 5.3L4.5 16.3a1.6 1.6 0 0 0 2.3 2.3l4.8-4.8a4 4 0 0 0 5.3-5.3l-2.3 2.3-2-.4-.4-2z"/></svg>
        </span>
        <span>
          <span class="card__name">Wrenfield Garage</span>
          <span class="card__where">Service and repair</span>
        </span>
      </header>
      <h1 class="card__title" id="card-title">Fixed prices, before we touch the car.</h1>
      <p class="card__text">Tell us what it needs. A mechanic writes back with a price you can hold us to.</p>

      <div class="steps" data-steps aria-hidden="true"><span><i data-bar></i></span><span><i data-bar></i></span></div>

      <div class="quote" data-quote>
        <span class="quote__shine" data-shine aria-hidden="true"></span>

        <button class="quote__layer quote__idle" type="button" data-idle aria-expanded="false">
          <span>Request a quote</span>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5 12 8l-3.5 3.5"/></svg>
        </button>

        <div class="quote__layer quote__service" data-service role="radiogroup" aria-label="What does the car need?">
          <span class="quote__ask">Needs</span>
          <span class="quote__mark" data-mark aria-hidden="true"></span>
          <button class="quote__chip" type="button" role="radio" aria-checked="false" data-chip>Service</button>
          <button class="quote__chip" type="button" role="radio" aria-checked="false" data-chip>Brakes</button>
          <button class="quote__chip" type="button" role="radio" aria-checked="false" data-chip>Tyres</button>
        </div>

        <form class="quote__layer quote__mail" data-mail novalidate>
          <span class="quote__picked" data-picked>Brakes</span>
          <label class="quote__field">
            <span class="sr">Your email</span>
            <input type="email" data-input placeholder="you@email.com" autocomplete="off" spellcheck="false">
          </label>
          <button class="quote__send" type="submit" data-send aria-label="Send">
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5 12 8l-3.5 3.5"/></svg>
            <span class="quote__spin" data-spin></span>
          </button>
        </form>

        <button class="quote__layer quote__done" type="button" data-done>
          <svg class="quote__tick" viewBox="0 0 16 16" aria-hidden="true"><path data-tick d="M3.5 8.4 6.6 11.3 12.5 4.9" pathLength="1"/></svg>
          <span>Quote on its way</span>
        </button>
      </div>

      <svg class="envelope" data-envelope viewBox="0 0 40 28" aria-hidden="true">
        <rect x="1" y="1" width="38" height="26" rx="4"/>
        <path class="envelope__flap" d="M2.5 3.5 20 15.5 37.5 3.5"/>
      </svg>

      <p class="card__note" aria-live="polite"><span data-note>A reply within two hours, Monday to Saturday.</span></p>
    </section>
    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></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.

31 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 “Two-step quote button” 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 page sits the card of Wrenfield Garage, a made-up workshop: the mark, «Fixed prices, before we touch the car.», two lines and the black «Request a quote» pill with its arrow. Pressed, it squashes and opens inside itself on the first step: «Needs» and three options, Service, Brakes and Tyres, with a cream mark springing under the one you point at. Pick one and the pill stretches across the whole card: the option stays on the left as a small tag, then the email field and the orange round send button; above the pill two thin bars fill one per step. A wrong email makes the pill shake. Sent, the arrow gives way to a spinner, then the pill closes on «Quote on its way» with a green tick drawing itself, a light crosses it, a drawn envelope leaves the pill and flies off upwards, the bars fade, a green glow wakes under the card and the note says who it went to and that the reply comes within two hours. Pressed again, the pill goes back to «Request a quote». Until a real pointer arrives, a drawn pointer plays it all by itself.

How it works

One pill, four layers

The pill is a single element with four stacked layers: the button, the services, the email form and the confirmation. GSAP changes its width by measuring the natural width of the incoming layer (width: max-content for a moment), on a back.out curve with OVERSHOOT; the form takes the whole width of the card.

The mark under the option

The cream mark is a single element behind the three options: it moves to the offsetLeft and offsetWidth of the option you point at, on a back.out spring, and stays under the chosen one.

The two steps

Two bars above the pill fill with scaleX, one per step; the form is a real form, sending checks the email with a regex and, if it is wrong, the pill shakes with keyframes on x.

Sending

The arrow shrinks and a spinner turns; then the pill closes on the confirmation, the tick draws with stroke-dashoffset on pathLength 1, the envelope leaves the middle of the pill and flies up turning and fading, the green glow rises and the note slides to its new text.

The pilot

A drawn pointer opens the pill, hovers the options, picks Brakes, types the email letter by letter, sends and then closes: all on a GSAP timeline that stops at the first real gesture (pointermove, pointerdown or a key).

Values to change

NameFileDefaultWhat it changes
OPENscript.js0.6Seconds for the pill to open into a step.
CLOSEscript.js0.55Seconds for the pill to close on «Quote on its way».
OVERSHOOTscript.js1.4How far the pill passes its width before settling (0 none).
PRESSscript.js0.96How much the pill squashes under the finger (1 never).
TYPINGscript.js0.065Seconds per letter when the pilot types the email.
FLIGHTscript.js1.1Seconds of the envelope flight (0 no envelope).
GLOWscript.js1How bright the green glow is once the quote is sent (0 none).
SPEEDscript.js12 = the pilot twice as fast, 0.5 = half.

Try them in the Playground

When to use it

On the page of a garage, a craftsperson, a service business or a supplier: visitors ask for a quote without leaving the page and without a long form, in two gestures inside the same button.

On phones

The same animation with adapted sizes: the card is 92% of the screen wide, the pill is a little lower, the word «Needs» goes and the options are narrower, so the first step stays inside the card.

With reduced motion

Nothing moves: the pill changes width at once, the layers swap with a fade, the envelope does not fly and the tick appears already drawn.

Pitfalls

  • A layer's natural width is measured only after document.fonts.ready and by dropping right: 0 for a moment, otherwise the absolute layer measures as wide as the pill.
  • Hidden layers must be hidden with autoAlpha (visibility), not only opacity: a transparent button stays clickable on top of another.
  • The pilot types with input.value on a GSAP timeline, never with setTimeout, so it stops with everything else when the real pointer arrives.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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