Skip to content
animorio
IT
All components

Filters sliders button

Buttons, HoverGSAP, CSS onlyEasyCompressed weight: Demo 4.2 KBGSAP 28 KBFreeDownload the zip

One button, one gesture, in the simple style of product interface pieces: the black «Filters» pill with the three-slider icon; on tap the three knobs glide to new places one after the other, each overshooting by a pixel, their tracks fill in the accent colour behind them and the number of active filters arrives beside the word. On a second tap everything goes home.

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>
<!--
  "Filters sliders 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 Filters button with the sliders gliding into place</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" data-stage>
    <!-- one button, one gesture: the three little slider knobs glide to new places, the tracks fill, a count arrives -->
    <button class="filters" type="button" data-filters aria-pressed="false" aria-label="Filters">
      <span class="filters__body" data-body>
        <svg class="filters__icon" viewBox="0 0 32 32" aria-hidden="true" data-icon>
          <g data-row>
            <line class="filters__track" x1="6" y1="9" x2="26" y2="9"/>
            <line class="filters__fill" data-fill x1="6" y1="9" x2="6" y2="9"/>
            <rect class="filters__knob" data-knob x="18.4" y="5.5" width="3.2" height="7" rx="1.6"/>
          </g>
          <g data-row>
            <line class="filters__track" x1="6" y1="16" x2="26" y2="16"/>
            <line class="filters__fill" data-fill x1="6" y1="16" x2="6" y2="16"/>
            <rect class="filters__knob" data-knob x="10.4" y="12.5" width="3.2" height="7" rx="1.6"/>
          </g>
          <g data-row>
            <line class="filters__track" x1="6" y1="23" x2="26" y2="23"/>
            <line class="filters__fill" data-fill x1="6" y1="23" x2="6" y2="23"/>
            <rect class="filters__knob" data-knob x="15.4" y="19.5" width="3.2" height="7" rx="1.6"/>
          </g>
        </svg>
        <span class="filters__label" data-label>Filters</span>
        <span class="filters__slot" data-slot aria-hidden="true">
          <span class="filters__badge" data-badge><span class="filters__count" data-count>3</span></span>
        </span>
      </span>
    </button>
  </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.

13 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 “Filters sliders 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 white, alone in the middle, there is a black pill with the filters icon, three thin tracks each with its narrow knob, and the word «Filters». On tap the pill gives a little and comes back on a spring; the three knobs glide to new places one after the other: each one first pulls back by a hair, stretches while it runs, lands a pixel past its mark and settles. Behind each knob its track fills in the accent colour, a beat late. Meanwhile room opens beside the word for a small accent capsule with the number of active filters, which grows on a spring and rolls its digit up from below. On a second tap the number rises away, the room closes, the colour drains back to the start of the tracks and the knobs go home, the last one first. Hovering brings the pill a touch closer and each knob hints a one-pixel step. Until someone touches it, the pill plays the gesture by itself.

How it works

Three rows of SVG

Each row of the icon is a track, a coloured track over it and a rounded rect for the knob. The knob has a border in the pill’s colour with paint-order stroke: it cuts the track by itself, with no masks.

One object per knob

GSAP does not animate the attributes one by one: it animates one object per row (centre, width, fill, opacity) and a single function rewrites x, width and x2. That way the knob can stretch while it runs and stay centred, and the coloured track never passes it.

The step back and the settle

Each run is four tweens: 0.6 units the wrong way, the run with back.out (the pixel past the mark), the width rising to 4.6 and back to 3.2 with elastic.out. The three knobs start 70 milliseconds apart.

Room for the number

The number’s capsule sits in a slot zero wide: the slot opens with back.out to the capsule’s width measured beforehand, the capsule grows and the digit rolls up from below. On the way out the order is reversed: first the digit, then the capsule, then the room.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#c4f04aThe colour of the filled tracks and of the count.
LABELscript.jsFiltersThe word on the pill.
COUNTscript.js3How many filters the count says once they are on.
SPRINGscript.js1How springy the knobs and the pill are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2.2How many seconds each state stays when the button plays by itself.
AUTOscript.jstrueThe button plays the gesture by itself until someone touches it.

Try them in the Playground

When to use it

For the button that opens or applies the filters in a catalogue, a search or a dashboard table: the moved knobs and the count say by themselves that the list is now filtered.

On phones

On the phone the pill and the icon take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.

With reduced motion

The icon fades out and back in with the knobs already in their new places and the tracks already filled; the count fades in, with no springs or movement.

Pitfalls

  • With the coloured track zero long, the round cap still draws a small dot: at rest it has to be switched off with opacity, not only shortened.
  • The capsule’s width has to be measured with offsetWidth, which ignores transforms: with getBoundingClientRect, with the capsule still at scale zero, the slot did not open and the number ended up over the word.
  • The coloured track is clipped at the knob’s centre: without that limit, on arrival with back.out the colour would pass the knob for an instant and show beyond its edge.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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