Skip to content
animorio
IT
All components

Amenities filter

Pickers, HoverGSAP, CSS onlyEasyCompressed weight: Demo 5.5 KBGSAP 28 KBFreeDownload the zip

The amenities filter in a stay search: six amenities to switch on (pool, pet friendly, parking, breakfast, spa, sea view). Each amenity switched on takes colour, its icon lights up and a tick draws; meanwhile the stays left count to the new number, the bar shortens on a spring, the sentence says what is being asked for and the button updates its number.

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>
<!--
  "Amenities filter" 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>Amenities filter</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 amenities filter of a hotel search: every amenity switched on narrows the stays, the count rolls,
         the bar shortens and the sentence says what is being asked for -->
    <section class="am" data-am aria-labelledby="am-title">
      <header class="am__head">
        <span class="am__name"><b id="am-title">Stays in Lisbon</b><span>12 – 15 June, 2 guests</span></span>
        <span class="am__count" aria-live="polite"><b data-count>128</b><span>stays</span></span>
      </header>
      <div class="am__meter" aria-hidden="true"><i data-meter></i></div>

      <div class="am__grid" role="group" aria-label="Amenities">
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.42"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.500 15c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M3.500 19c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M8 12.500V6a2 2 0 0 1 4 0M14 12.500V6a2 2 0 0 1 4 0M8 9.500h6"></path></svg><span>Pool</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.31"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 12.500c-2.400 0-4.500 2.300-4.500 4.300 0 1.300 1 2.200 2.300 2.200.900 0 1.400-.400 2.200-.400s1.300.400 2.200.400c1.300 0 2.300-.900 2.300-2.200 0-2-2.100-4.300-4.500-4.300ZM7 10.500a1.400 1.800 0 1 0 0-.100ZM10.500 6.500a1.400 1.800 0 1 0 0-.100ZM16.300 6.500a1.400 1.800 0 1 0 0-.100ZM19.800 10.500a1.400 1.800 0 1 0 0-.100Z"></path></svg><span>Pet friendly</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.58"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="4.500" y="4.500" width="15" height="15" rx="4"></rect><path d="M10 16V8h2.600a2.400 2.400 0 0 1 0 4.800H10"></path></svg><span>Parking</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.66"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 10h11v3.500a5.500 5.500 0 0 1-11 0ZM16 11h1.500a2 2 0 0 1 0 4H16M8 4.500c0 1 1 1 1 2M12 4.500c0 1 1 1 1 2M4.500 20.500h12"></path></svg><span>Breakfast</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.24"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20c-4.400 0-7.500-2.500-8-6 2.300-.200 4.200.500 5.600 1.900M12 20c4.400 0 7.500-2.500 8-6-2.300-.200-4.200.500-5.600 1.900M12 20c-2.200-1.800-3.300-4-3.300-6.800 0-2.900 1.200-5.500 3.300-7.700 2.100 2.200 3.300 4.800 3.300 7.700 0 2.800-1.100 5-3.300 6.800Z"></path></svg><span>Spa</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
        <button class="am__chip" type="button" aria-pressed="false" data-chip data-keep="0.37"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.500 18c1.400 0 1.400 1 2.800 1s1.400-1 2.800-1 1.400 1 2.800 1 1.400-1 2.800-1 1.400 1 2.800 1M6.500 14.500a5.500 5.500 0 0 1 11 0M12 5v1.500M5.200 7.800l1.100 1.100M18.800 7.800l-1.100 1.100"></path></svg><span>Sea view</span><i class="am__tick" aria-hidden="true"><svg viewBox="0 0 16 16"><path pathLength="1" d="m3.500 8.300 3 3 6-6.600"></path></svg></i></button>
      </div>

      <p class="am__say"><span data-say>Any amenities</span></p>

      <div class="am__foot">
        <button class="am__clear" type="button" data-clear disabled>Clear</button>
        <button class="am__go" type="button" data-go><span class="am__gotext"><span data-golabel>Show 128 stays</span></span></button>
      </div>
    </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.

25 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 “Amenities filter” 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: “Stays in Lisbon”, “12 – 15 June, 2 guests” and on the right the large number, “128 stays”, with a full teal bar below. Then six amenities in two columns, each with a line icon: Pool, Pet friendly, Parking, Breakfast, Spa, Sea view. Below, the sentence “Any amenities” and at the bottom “Clear”, off, and the button “Show 128 stays”. Touch “Pool” and the tile bounces, takes a teal edge and veil, the icon lights up and a tick draws on the right; the number counts to 54 with a small jump, the bar shortens going slightly past and back, the sentence rolls to “With pool” and the button to “Show 54 stays”. With “Pet friendly” 17 stays are left, “With pool and pet friendly”; with “Breakfast” 11. Remove an amenity and the number goes back up. If nothing is left the button goes off and says “No stays match”. “Clear” switches everything off and the count returns to 128.

How it works

One number

The stays left are the total times what each chosen amenity lets through. From that number a function works out the count, the bar, the sentence and the button’s words.

The amenity switched on

Each amenity is a button with aria-pressed: CSS colours edge, ground and icon and draws the tick (a path with pathLength 1); GSAP only gives the bounce.

The count

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

The bar

scaleX equal to the stays left divided by the total, on a spring that goes slightly past the size.

The sentence

The names of the chosen amenities lined up with commas and “and” before the last: it says in words what the colours show.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#4fd1c5The colour of the chosen amenities, of the bar and of the button.
STAYSscript.js128How many stays there are before filtering.
COUNTscript.js0.55How long the changing count of stays lasts.
SPRINGscript.js1How much the amenities and the number bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer switches on three amenities, removes one and clears.

Try them in the Playground

When to use it

In the search of a site for hotels, holiday homes, campsites or farm stays, and wherever a list is filtered by features: flats to rent, restaurants, gyms, event spaces.

On phones

The same card, as wide as the screen minus the margins: the amenities stay in two columns, 42 pixels tall, with long names cut by an ellipsis; the sentence below never wraps.

With reduced motion

No bounces and no counting numbers: the amenity changes colour and the tick appears, the count, the bar, the sentence and the button go straight to the new value. The demo does not move by itself.

Pitfalls

  • City, dates and numbers are made up: on a real site the search says how many stays are left, and it is worth asking while people choose so a button never leads to zero results.
  • The amenity switched on is not told by colour alone: there is the tick, and the sentence below lists them all.
  • When no stay is left the button is disabled and says so, instead of leading to an empty page.
  • The bounce is on the whole button and the tick is drawn by CSS in a child element: so the two movements do not cancel each other.
  • A tick with pathLength 1 and round caps leaves a dot when hidden: its container has zero opacity until it is needed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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