Skip to content
animorio
IT
All components

NPS survey

Ratings, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.2 KBGSAP 28 KBFreeDownload the zip

The NPS survey of a made-up app, Tally, in a white card: “How likely are you to recommend Tally to a friend?” with a 0 to 10 scale in eleven tiles. The chosen score fills from the bottom with a colour that slides in a single hue from the warm grey of 0 to the green of 10, the other tiles dim, and the card grows on a spring with the question that depends on the score (What went wrong?, What would make it a 10?, What do you love most?), the answer field and three suggestion pills. Send squeezes the pill and the card closes into a thank-you with a tick drawing itself; Not now folds it into a small Give feedback pill that opens it again. Minimal style.

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>
<!--
  "NPS survey" 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>NPS survey</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 NPS survey of a made-up app, Tally: a score from 0 to 10, a follow-up question that depends on the score,
         three suggestion pills, Send, and a thank-you. Not now folds the card into a small pill that opens it again -->
    <section class="card" data-card aria-labelledby="nps-q">
      <div class="card__body" data-body>

        <div class="face face--ask" data-face="ask">
          <header class="top">
            <span class="brand"><svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.5" y="2.5" width="15" height="15" rx="4.5"></rect><path d="M7 7.6h6M10 7.6v5.6"></path></svg>Tally</span>
            <button class="later" type="button" data-later>Not now</button>
          </header>

          <h2 class="q" id="nps-q" data-question>How likely are you to recommend Tally to a friend?</h2>

          <div class="scale" role="radiogroup" aria-labelledby="nps-q" data-scale></div>
          <div class="ends" aria-hidden="true"><span>Not likely</span><span>Very likely</span></div>

          <div class="more" data-more>
            <div class="more__in" data-more-in>
              <div class="follow" aria-live="polite">
                <span class="follow__line" data-follow>What would make it a 10?</span>
              </div>
              <label class="field">
                <span class="sr">Your answer</span>
                <input class="field__input" type="text" data-input placeholder="Tell us in a few words" autocomplete="off">
              </label>
              <div class="chips" data-chips></div>
              <div class="actions">
                <span class="count" data-count aria-hidden="true"></span>
                <button class="send" type="button" data-send>
                  <span class="send__bg" aria-hidden="true"></span>
                  <span class="send__label">Send</span>
                  <svg class="send__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5L12 8l-3.5 3.5"></path></svg>
                </button>
              </div>
            </div>
          </div>
        </div>

        <div class="face face--thanks" data-face="thanks" aria-hidden="true">
          <svg class="tick" viewBox="0 0 44 44" aria-hidden="true"><circle cx="22" cy="22" r="19" data-ring pathLength="1"></circle><path d="M14.5 22.6l5.2 5 9.8-10.4" data-check pathLength="1"></path></svg>
          <p class="thanks__t">Thanks, that helps.</p>
          <p class="thanks__s" data-thanks-s>We read every answer, usually the same week.</p>
          <button class="again" type="button" data-again>Change my answer</button>
        </div>
      </div>
    </section>

    <div class="pill-wrap"><button class="pill" type="button" data-pill aria-hidden="true" tabindex="-1">
      <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 4.5h10v6H8l-3 2.5v-2.5H3z"></path></svg>
      <span>Give feedback</span>
    </button></div>

    <p class="sr" aria-live="polite" data-live></p>
  </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.

30 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “NPS survey” 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, a white card with a soft shadow: at the top the line mark of Tally, a made-up app, and Not now; the question “How likely are you to recommend Tally to a friend?” and below it eleven light grey tiles numbered 0 to 10, with Not likely and Very likely at the ends. Hovered, a tile darkens slightly. Pick a score and the tile fills from the bottom with its colour, which runs from the warm grey of 0 to the green of 10 through the shades between, hops four pixels and back, a light passes over it and the number turns white; the other tiles drop to 42%. The card grows on a spring and the second question arrives, which changes with the score: 0 to 6 What went wrong?, 7 and 8 What would make it a 10?, 9 and 10 What do you love most?; crossing bands the old question leaves upwards before the new one comes in, and the three suggestion pills are rebuilt (Too slow, Faster sync, Saves me time…). Below, the field “Tell us in a few words”, the letter count, and Send, a black pill whose label widens on the width axis on hover. Tapped, a pill fills with black from inside with a bounce. Send squeezes and springs back, the question rises away and the card shortens on a spring into the thank-you: a circle and a tick in the score’s colour drawing themselves, Thanks, that helps., and Change my answer to start over. Not now folds the card down into a small white Give feedback pill that opens it again on a spring. With the keyboard the arrows run along the scale like a row of radios.

How it works

One sliding hue

The chosen tile’s colour is a mix of two colours, the warm grey of 0 and the green of 10, in proportion to the score: no traffic light, a single hue warming up towards green. The same colour goes to the thank-you tick through the --tinta variable on the card.

The card follows the question

The second-question panel has zero height; its content is measured and GSAP brings the height to it with back.out, so the card, whose height is automatic, follows on a spring. When done the height goes back to auto and the layout stays free.

Questions that never overlap

When the score band changes, the old question leaves upwards in 0.22 seconds and only then does the new one come in from below: at any moment only one can be read. The old pills go before the new ones arrive.

The thank-you, to size

The thank-you sits on top of the question: its height is measured and the card goes from the question’s height to it on a spring, while the circle and the tick draw with strokeDashoffset on pathLength 1 paths with autoRound off.

Values to change

NameFileDefaultWhat it changes
APP_NAMEscript.jsTallyThe app’s name in the question and the mark.
LOW_COLORscript.js#a79f95The colour of a 0.
HIGH_COLORscript.js#2f8f5eThe colour of a 10; the ones in between slide between the two.
FILL_TIMEscript.js0.42How long the chosen tile takes to fill.
SPRINGscript.js1.4How far the card overshoots and comes back when it changes height.
DIMscript.js0.42The opacity of the tiles not chosen.
OPEN_TIMEscript.js0.7How long the card takes to grow with the second question.
MAX_CHARSscript.js140How many letters the answer can have.

Try them in the Playground

When to use it

To ask for an opinion inside an app or a subscription product, after an online purchase, at the end of a course or a stay, or on a newsletter page.

On phones

The card takes the width with a margin, the eleven tiles sit in a grid that tightens and sizes and gaps also follow the height with clamp, so with the second question open everything fits the preview box. Touch replaces hover.

With reduced motion

No hops or springs: the tile takes its colour at once, the second question and the thank-you fade in, the tick is already drawn and the self-running preview does not start.

Pitfalls

  • Two questions swapping in the same window read overlapped if they come in together: the old one leaves first, then the new one enters.
  • If the second question opens while the card is still animating its height, it stays clipped: before opening, the height tween is stopped and set back to auto.
  • Mona Sans’s tabular figures look like a mono face: the tiles use the normal figures.
  • Focus given by a script shows the ring even when nobody used the keyboard: it is given only when a person did the action.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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