Skip to content
animorio
IT
All components

Test mode switch

Toggles, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.4 KBGSAP 28 KBFreeDownload the zip

The switch between real and test data in a payments dashboard: turning it on, the striped yellow band “Test mode. No real money moves.” comes in at the top of the card, the API key rewrites itself character by character from pk_live to pk_test, the volume and the payment count run down to the test figures and the card’s green turns yellow.

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>
<!--
  "Test mode switch" 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>Test mode switch</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 Test / Live switch of a payments dashboard: the striped test band comes in,
         the API key rewrites itself character by character and the figures turn to test data -->
    <i class="frame" data-frame aria-hidden="true"></i>
    <section class="tm" data-tm data-mode="live" aria-label="Payments">
      <div class="tm__band" data-band aria-hidden="true"><span class="tm__stripes" data-stripes></span><span class="tm__note">Test mode. No real money moves.</span></div>
      <div class="tm__in">
        <header class="tm__head">
          <span class="tm__brand"><strong>Corvid Pay</strong><span class="tm__env"><span data-outenv>Live data</span></span></span>
          <button class="tm__switch" type="button" role="switch" aria-checked="false" data-switch><span class="tm__label">Test mode</span><span class="tm__track"><i class="tm__knob" data-knob></i></span></button>
        </header>
        <p class="tm__stat"><span class="tm__cap">Gross volume, today</span><strong>$<span data-outvolume>48,210.50</span></strong><span class="tm__sub"><b data-outcount>312</b> payments</span></p>
        <div class="tm__key"><span class="tm__cap">Publishable key</span><code data-outkey>pk_live_9fK2aW7cQx41</code></div>
      </div>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

23 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 “Test mode switch” 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 black, a dark card with a green glow beneath: “Corvid Pay” with “Live data” in green, on the right the “Test mode” switch turned off; then today’s volume in large type, “$48,210.50”, with “312 payments”, and at the bottom the publishable key in a box with a green left edge. On tap the knob stretches, crosses the track, squashes slightly on arrival and settles, and the track turns yellow. At the top of the card a yellow band opens, with diagonal stripes that slide for a moment and the words “Test mode. No real money moves.”; “Live data” rolls into “Test data”, the volume counts down to “$1,234.00” and the payments to 8. In the key the characters scramble and stop one after the other from the left, until it reads pk_test_4eR8mZ1bTy06; the card’s edge and glow go yellow. Turning the switch off closes the band and everything returns to live data.

How it works

The knob and the band

The knob widens by a few pixels as it leaves, reaches the other side without overshooting and there squashes and settles on a spring. The band is a block zero tall at the top of the card: GSAP takes its height to thirty pixels, and the stripes inside slide while it opens.

The key rewriting itself

A number goes from zero to one: it says how many characters of the new key are already in place. Those after it are written at random on every other frame, with the underscores always still.

Two sets of data

Live and test data are two objects with the same fields. On the change, volume and payments count from one to the other, and a single attribute on the card changes the colour of everything.

Values to change

NameFileDefaultWhat it changes
TESTscript.js#ffb020The colour of test mode.
LIVEscript.js#36d399The colour of live data.
LIVE_VOLUMEscript.js48210.5Today’s volume with live data, in dollars.
TEST_VOLUMEscript.js1234Today’s volume with test data.
SCRAMBLEscript.js0.9How many seconds the key takes to rewrite itself.
SPRINGscript.js1How much the knob and the band bounce.

Try them in the Playground

When to use it

In the dashboard of a payments, email, SMS or shipping service, where developers move between the test environment and the real one; in any app with a demo mode or a preview that must be told apart from real data.

On phones

The card is at most 318 pixels wide and about 245 tall with the band open; the big figure and the gaps are sized on height too. The switch is 36 pixels tall with its label, which is part of the button: it is thumb-sized and nothing depends on hover.

With reduced motion

The knob changes side at once, the band is open or closed immediately, figures and key take their new value with no counting and no scramble. The demo’s pointer does not start.

Pitfalls

  • It is a real switch (role switch, aria-checked): the “Test mode” label sits inside the button, and the change is read out in an aria-live region together with the new key.
  • The mode is not told by colour alone: there is the band with its sentence and the “Test data” label.
  • The band changes the card’s height: in a real page leave room for it, or the content below moves by thirty pixels.
  • Keys and figures are invented. In a real product the secret key is never shown in full, and switching mode reloads the data from the server.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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