Skip to content
animorio
IT
Back to the library

Room minibar

Hover, TransitionsGSAP, CSS onlyEasyCompressed weight: Demo 6.2 KBGSAP 28 KBFreeDownload the zip

The minibar of a hotel room on the guest’s phone: six things in a grid, each with its icon, its price and two marks saying how many are left. Tap what you take and the tile bounces, the count pops out, a mark empties and the total rolls onto the room bill. The minus puts one back. At the bottom “Restock” asks for a refill and confirms with a tick that draws itself.

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>
<!--
  "Room minibar" 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>Room minibar</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 minibar of a hotel room: tap what you take, the count pops on the tile, the shelf marks empty out,
         the total rolls onto the room bill and housekeeping can be asked to restock -->
    <section class="mb" data-mb aria-labelledby="mb-title">
      <header class="mb__head">
        <span class="mb__name"><b id="mb-title">Minibar</b><span>Room 412, Hotel Aurelia</span></span>
        <span class="mb__total" aria-live="polite"><b>&euro;<span data-total>0</span></b><span class="mb__on"><span data-on>Nothing taken</span></span></span>
      </header>

      <div class="mb__grid" role="group" aria-label="Minibar items">
        <div class="mb__tile" data-item data-price="4"><button class="mb__hit" type="button" aria-label="Take one Still water, 4 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 3.500h4v2.800l1.600 2.600v10.100a1.500 1.500 0 0 1-1.500 1.500h-4.200a1.500 1.500 0 0 1-1.500-1.500V8.900L10 6.300ZM8.400 12.500h7.200M8.400 16h7.200"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Still water</b><span>&euro;4</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Still water back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
        <div class="mb__tile" data-item data-price="14"><button class="mb__hit" type="button" aria-label="Take one Prosecco, 14 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.500 3.500h7l-.6 6.200a2.900 2.900 0 0 1-5.800 0ZM12 12.600v7.900M9 20.500h6M9.200 7.300h5.600"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Prosecco</b><span>&euro;14</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Prosecco back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
        <div class="mb__tile" data-item data-price="7"><button class="mb__hit" type="button" aria-label="Take one Craft beer, 7 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M9.700 3.500h4.600v3l1.700 2.400v10.600a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8.900l1.700-2.400ZM8 12h8v4.500H8Z"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Craft beer</b><span>&euro;7</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Craft beer back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
        <div class="mb__tile" data-item data-price="5"><button class="mb__hit" type="button" aria-label="Take one Chocolate, 5 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 4.500h12v15H6ZM6 9.500h12M6 14.500h12M12 4.500v15"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Chocolate</b><span>&euro;5</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Chocolate back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
        <div class="mb__tile" data-item data-price="6"><button class="mb__hit" type="button" aria-label="Take one Almonds, 6 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4c3.600 2.300 5.400 5.200 5.400 8.400 0 3.900-2.400 7.100-5.400 7.600-3-.500-5.400-3.700-5.400-7.600C6.600 9.200 8.400 6.300 12 4ZM12 8v8"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Almonds</b><span>&euro;6</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Almonds back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
        <div class="mb__tile" data-item data-price="4"><button class="mb__hit" type="button" aria-label="Take one Cola, 4 euros"></button><svg class="mb__ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M8.500 6.500 9.500 4h5l1 2.500v11l-1 2.500h-5l-1-2.500ZM8.500 6.500h7M8.500 17.500h7M10.200 10.500c1.200 1 2.400 1 3.600 0"></path></svg><span class="mb__n" aria-hidden="true"><b data-n>1</b></span><span class="mb__what"><b>Cola</b><span>&euro;4</span></span><span class="mb__stock" aria-hidden="true"><i></i><i></i></span><button class="mb__less" type="button" data-less aria-label="Put one Cola back" tabindex="-1"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button></div>
      </div>

      <button class="mb__go" type="button" data-go disabled><svg viewBox="0 0 16 16" aria-hidden="true"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg><span class="mb__gotext"><span data-golabel>Request restock</span></span></button>
    </section>

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

36 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 “Room minibar” 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: “Minibar”, “Room 412, Hotel Aurelia” and on the right the total, “€0”, with “Nothing taken” below. Then six tiles in three columns, each with a line icon, the name, the price and two light marks: Still water, Prosecco, Craft beer, Chocolate, Almonds, Cola. At the bottom the “Request restock” button, off. Tap “Still water” and the tile bounces and takes a golden edge, the icon gives a small hop, a golden pill with “1” pops out at the top right, a mark empties and a minus button appears; the total counts to 4 with a small kick and “1 item on the room bill” rolls in below. With the second prosecco taken the pill goes to “2”, the marks are empty and the tile can no longer be tapped. The minus puts one thing back: the total drops and the mark fills again. The button at the bottom, now golden, says “Restock 3 items”: tap it and it becomes “Restock requested”, with a tick drawing itself.

How it works

The state

For each thing, how many have been taken. One function works out the total, the sentence below and the button’s label; another, for each tile, the edge, the pill, the marks and whether it can still be tapped.

The tile

The whole tile is a button; the minus is a second button on top, appearing only when there is something to put back. The pill comes in from scale zero on an elastic spring, and when the number changes the figure rolls.

The total

A number in an object taken to the new value in COUNT seconds and written rounded on every frame, with tabular figures and a small kick of scale.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#e2b04aThe colour of the things taken, of the total and of the button.
STOCKscript.js2How many of each thing the minibar holds: 1 or 2.
COUNTscript.js0.5How long the total takes to count to the new value.

Try them in the Playground

When to use it

In the app or room page of a hotel, a b&b or a holiday home with a paid pantry, and wherever people note down what they take themselves: the office fridge, a club’s bar, a spa’s extras.

On phones

The same card, as wide as the screen minus the margins: the tiles stay in three columns, 78 pixels tall, the whole tile is tappable and the minus is 26 pixels wide with room around it. The card is about 300 pixels tall and fits whole in the phone box.

With reduced motion

No bounces and no counting or rolling numbers: the tile changes colour, the pill appears with its number, the total, the sentence and the button go straight to the new value. The demo’s pointer does not start.

Pitfalls

  • Hotel, room and prices are made up: on a real site what the minibar holds and what has been taken live in the hotel’s system, and the charge has to be confirmed by the server.
  • How many are left is not told by colour: it is the two marks, and once stock is gone the tile is disabled and says so to screen reader users.
  • Taking something else after asking for a restock lights the button again: the request covers what was missing at that moment.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 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 animations