Skip to content
animorio
IT
All components

Multi-select dropdown

Forms, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

A dropdown where more than one option can be chosen. The panel drops from under the field on a spring; each chosen option fills its box and draws the tick, and lands in the field as a pill. The ones that do not fit fold into a “+1”, a round counter says how many there are and at the bottom “Clear” empties it.

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>
<!--
  "Multi-select dropdown" 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>Multi-select dropdown with the ticks and the summary that counts</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">
    <!-- a dropdown where more than one option can be chosen: each tick draws itself, the choices land in the
         field as small pills, the ones that do not fit fold into a "+2" and the counter rolls -->
    <div class="ms" data-ms>
      <span class="ms__label" id="ms-label">Subjects</span>
      <button class="field" type="button" data-field aria-haspopup="listbox" aria-expanded="false" aria-labelledby="ms-label">
        <span class="field__hint" data-hint>Choose subjects</span>
        <span class="field__chips" data-chips></span>
        <span class="field__count" data-count-box aria-hidden="true"><span data-count>0</span></span>
        <svg class="field__chev" data-chev viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6.200 8 10l4-3.800"></path></svg>
      </button>
      <div class="panel" data-panel hidden>
        <ul class="opts" data-opts role="listbox" aria-multiselectable="true" aria-labelledby="ms-label"></ul>
        <div class="panel__foot"><span data-foot>None chosen</span><button type="button" data-clear>Clear</button></div>
      </div>
    </div>
    <p class="sr" data-live aria-live="polite"></p>

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

24 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 “Multi-select dropdown” 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, the label “Subjects” and below it a rounded field with the grey text “Choose subjects” and a small chevron. Pressed, the border turns blue with a halo, the chevron flips and the panel drops from under the field with a small swing, the five options one after the other: each has a box, the name and on the right the days. Choosing one, the box fills with blue from the centre, the white tick draws itself, the row gets a light tint; a pill with the name lands in the field and on the right a blue disc with the number. From the third on the extra choices become a grey “+1”. At the bottom of the panel “3 of 5 chosen” and the “Clear” button, which removes all the ticks together. Outside the panel or with Esc it closes and the summary stays in the field.

How it works

The state

A list of true and false, one per option. From there one function rewrites the field: the first MAX_PILLS choices as pills, the rest in a “+N”, the counter and the bottom line. Only what is new is animated, the pill that just landed or the “+N” that changes.

The tick

Each box has a blue square going from scale 0 to 1 with back.out and a path with pathLength 1 that draws itself 0.1 seconds later; removing it, the stroke retracts first and then the square.

The panel

The panel starts at scaleY 0.86 and 10 pixels higher, with the origin at the top, and arrives with back.out; the options come in staggered by 0.035 seconds. The container already keeps the height of the open panel, so nothing around it moves.

Values to change

NameFileDefaultWhat it changes
OPTIONSscript.js[["Maths", "Mon, Wed"], ["Physics", "Tue"], ["Literature", "Thu"], ["History", "Fri"], ["Art", "Sat"]]The options: name and note on the right (made up).
CHOSENscript.js[]The options already chosen at the start, by name.
MAX_PILLSscript.js2How many choices show in the field before the “+N”.
HINTscript.js"Choose subjects"The text of the empty field.
ACCENTscript.js#2f6bffThe colour of the ticks.
OPENscript.js0.5How many seconds the panel takes to open.
LOOPscript.jstrueLeft alone, a pointer opens, picks three options, closes and then clears.

Try them in the Playground

When to use it

In a sign-up form (subjects, courses, interests), in the filters of a list or a dashboard, wherever a plain select would force you to hold a key to choose several options.

On phones

The same field, at most as wide as the screen minus the margins; the options are 40 pixels high and get shorter on a low screen, so the open panel stays fully visible.

With reduced motion

The panel appears and disappears without dropping, ticks and pills arrive already in place, the counter changes figure without rolling.

Pitfalls

  • The options are buttons with role option and aria-selected inside a listbox with aria-multiselectable: up and down arrows move between options, Esc closes and gives the focus back to the field.
  • The closed panel has the hidden attribute, not just zero opacity: otherwise tab would enter the invisible options.
  • The ticks are paths with pathLength 1: without autoRound turned off GSAP would make them jump from empty to full.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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