Skip to content
animorio
IT
All components

Wallet pocket button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

The Add to Wallet button of a travel app, with a single gesture: pressed, its top edge opens like a pocket, the boarding pass comes down from above, lines up with the slot and slides in, disappearing behind the face of the button; the pocket closes with a small bump, the counter on the wallet rolls from 3 to 4 and only then the label says Added, with the tick drawing itself. Pressed again, the pass rises back out and leaves.

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>
<!--
  "Wallet pocket 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 Add to Wallet button with the boarding pass that slides into its pocket</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">
    <!-- one gesture: press. The Add to Wallet button of a travel app: pressed, its top edge opens like a pocket, the
         boarding pass drops in from above, sinks behind the front of the button and the button closes over it with a
         small bump; the pass counter on the wallet rolls on and only then the label says Added. Pressed again, the
         pass slides back out and goes away -->
    <div class="unit" data-unit>
      <div class="pocket" data-pocket aria-hidden="true">
        <span class="lip" data-lip></span>
        <div class="pass" data-pass>
          <div class="pass__band">
            <span class="pass__air">Ferrow Air</span>
            <span class="pass__kind">Boarding pass</span>
          </div>
          <div class="pass__route">
            <span class="pass__code" data-from>LIS</span>
            <svg class="pass__plane" viewBox="0 0 64 12"><path class="pass__dash" d="M2 6h22M40 6h22"></path><path class="pass__jet" d="M27 6h10M34.5 2.6 37 6l-2.5 3.4M29.5 6l-1.6-2.6M29.5 6l-1.6 2.6"></path></svg>
            <span class="pass__code" data-to>AMS</span>
          </div>
          <div class="pass__meta">
            <span><em>Flight</em><b data-flight>FR 214</b></span>
            <span><em>Gate</em><b data-gate>B12</b></span>
            <span><em>Seat</em><b data-seat>14A</b></span>
            <span><em>Boards</em><b data-boards>08:40</b></span>
          </div>
          <div class="pass__perf"></div>
          <div class="pass__bars" data-bars></div>
        </div>
      </div>

      <button class="btn" type="button" data-btn aria-live="polite">
        <span class="btn__face" data-face>
          <span class="btn__shine" aria-hidden="true"></span>
          <span class="wallet" aria-hidden="true">
            <svg viewBox="0 0 24 24">
              <rect class="wallet__card wallet__card--b" x="5.2" y="3.6" width="13" height="8" rx="1.6"></rect>
              <rect class="wallet__card wallet__card--a" data-wcard x="4.2" y="5.4" width="14" height="8" rx="1.6"></rect>
              <path class="wallet__body" d="M3 9.6h18v9.2a1.6 1.6 0 0 1-1.6 1.6H4.6A1.6 1.6 0 0 1 3 18.8Z"></path>
              <path class="wallet__flap" d="M15.4 13.4h5.6v3.6h-5.6a1.8 1.8 0 0 1 0-3.6Z"></path>
            </svg>
            <span class="wallet__count" data-count><span data-digit>3</span></span>
          </span>
          <span class="btn__labels">
            <span class="btn__label" data-label="add">Add to Wallet</span>
            <span class="btn__label" data-label="adding">Adding</span>
            <span class="btn__label" data-label="added">
              <svg class="tick" viewBox="0 0 16 16"><path data-tick d="M3.4 8.4 6.6 11.4 12.6 4.8"></path></svg>
              Added
            </span>
          </span>
        </span>
      </button>

      <p class="note" data-note><span data-note-a>Your pass works offline</span><span data-note-b>4 passes in Wallet</span></p>
    </div>

    <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.

42 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 “Wallet pocket 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 background there is just a black button, wide and rounded, with a wallet drawn in a white line, a blue card peeking out of it, a small blue counter saying 3 and the label Add to Wallet; underneath, in grey, Your pass works offline. On hover the top edge of the button lifts by three pixels and a dark slot shows. Pressed, the button gives and springs back, the label rises away and Adding comes in; the slot opens by eight pixels and the Ferrow Air boarding pass comes down from above, turning slightly: the blue band with the airline’s name, LIS and AMS with the plane in between, flight FR 214, the gate, seat 14A, boarding at 08:40, the dashed line and the barcode. It stops for a moment above the button, lowers until it touches the slot and then slides in, speeding up, disappearing behind the face of the button. The pocket closes, the button squashes a little under the hit and comes back on a short elastic, the card in the wallet gives a small hop, the counter rolls from 3 to 4, Adding leaves and Added arrives with a tick that draws itself; below, the grey line changes to 4 passes in Wallet. Pressed again, the pocket opens, the pass rises back out, the number goes back to 3 and the pass flies away upwards, turning.

How it works

A pocket made of two layers

Behind the face of the button there is a darker copy of it, the lip of the pocket: lifting it by eight pixels shows the slot. The pass sits between the two, so on the way down it passes in front of the lip and behind the face, with no mask to animate.

The cut at the bottom edge

Pass and lip live in a container that ends exactly at the bottom edge of the button and cuts whatever goes beyond: once in, the pass never peeks out underneath.

A hit you can feel

When the pass is in, the face squashes for 70 thousandths (scaleY 0.94 from the bottom edge) and comes back with elastic.out(1, 0.38): it is the pocket closing.

One label at a time

The three labels (Add to Wallet, Adding, Added) share one cell: the old one rises away before the new one comes up from below with a small overshoot, so two words never show on top of each other.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f6bffThe airline colour: the band of the pass, the plane, the counter on the wallet.
DROPscript.js0.5How long the pass takes to slide into the pocket, in seconds.
BUMPscript.js0.06How much the button gives when the pass reaches the bottom.
OPENscript.js8How far the pocket opens above the button, in pixels.
PASSESscript.js3How many passes are already in the wallet.
FROMscript.jsLISThe departure airport.
TOscript.jsAMSThe arrival airport.
FLIGHTscript.jsFR 214The flight number.
SEATscript.js14AThe seat.
LABELscript.jsAdd to WalletThe button label at rest.

Try them in the Playground

When to use it

In the app or site of an airline, a train, a concert or a museum, after checkout: anywhere a ticket or a card can be saved to the phone’s wallet.

On phones

The same button, as wide as it needs and sized on the screen height too, with the pass scaling along. A finger presses like the mouse; there is no hover.

With reduced motion

No drops or hits: the pass appears and fades away, the labels and the counter swap with fades, the tick is already drawn, the drawn pointer does not start.

Pitfalls

  • Face and lip must be animated on two different elements: with a single element whose edge lifts, the pass could not go in between.
  • The pass positions depend on its height, which changes with the window: they are functions GSAP reads at every start, and on resize the pass goes back to its place.
  • No tabular figures with Mona Sans: the zero comes out slashed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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