Skip to content
animorio
IT
All components

Slash menu

Menus, Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The page of a team docs app, on white, in the style of real product UI pieces: on an empty line you type «/» and the block menu opens right at the caret, on a short spring. As you type, the items that don’t fit leave, the rest slide into their new place and the matched letters light up; the pill follows the arrow keys, the results count rolls and the window takes its new height with a small bounce. Enter flashes the item and the line becomes that block: a checkbox to tick, a quote, a divider.

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>
<!--
  "Slash menu" 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 slash menu that opens as you type</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>
    <!-- invisible frame around the page and the open block menu, below or above the line: the preview poster and video are framed on it -->
    <div class="cornice" data-inquadra aria-hidden="true"></div>
    <!-- a page of a team docs app: typing a slash on an empty line opens the block menu right at the caret.
         Typing filters it (items leave, the rest slide into their new order, the matched letters light up), the arrows
         move the pill, Enter flashes the item and turns the line into that block -->
    <section class="doc" data-card aria-label="Q4 launch plan, a page in Pagewise">
      <p class="doc__crumbs"><span>Pagewise</span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9.5 6 6 6-6 6"></path></svg><span>Launch</span></p>
      <h1 class="doc__title">Q4 launch plan</h1>
      <p class="doc__para">Pricing goes live on Nov 12. Everything below ships the week before.</p>
      <div class="doc__lines" data-lines></div>

      <div class="menu" data-menu role="listbox" aria-label="Insert a block" hidden>
        <div class="menu__list" data-list>
          <span class="menu__pill" data-pill aria-hidden="true"></span>
          <div class="menu__ghosts" data-ghosts aria-hidden="true"></div>
        </div>
        <div class="menu__empty" data-empty>
          <p class="menu__empty-title">No results for <span data-empty-q></span></p>
          <p class="menu__empty-hint">Try <em>quote</em>, <em>table</em> or <em>code</em></p>
        </div>
        <footer class="menu__foot">
          <span class="menu__keys">
            <kbd><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 18V6M7 11l5-5 5 5"></path></svg></kbd>
            <kbd><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 6v12M7 13l5 5 5-5"></path></svg></kbd>
            <span>Navigate</span>
            <kbd><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19 6v5a3 3 0 0 1-3 3H6M10 10l-4 4 4 4"></path></svg></kbd>
            <span>Insert</span>
          </span>
          <span class="menu__count" data-count aria-live="polite"><span class="menu__count-num" data-count-num>9</span> <span data-count-word>results</span></span>
        </footer>
      </div>
    </section>

    <textarea class="tasti" data-keys aria-label="Type in the page" autocapitalize="off" autocomplete="off" spellcheck="false"></textarea>
  </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.

30 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 “Slash menu” 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 sits a document page: the Pagewise and Launch breadcrumbs, the Q4 launch plan title, a line of grey text and below it an empty line with a blinking caret and the hint «Type ‘/’ for commands». You type the slash: it turns accent on a pale ground, and the block menu opens from the caret, a white window with a wide shadow growing from slightly smaller while the first items arrive one after another. The items sit in two groups, Basic blocks and Media, each with its thin-line icon in a box, the name, a grey line and, when there is one, the shortcut as a small key. Below, a strip with the keys to move and to insert and the number of results. Typing t keeps the items with that letter: the others fade away sideways, the ones left slide into their new order, the t lights up in the name, the number rolls from 9 to 5 and the window gets shorter with a small bounce. The arrows slide the grey pill from item to item, and the icon box of the chosen item rises a pixel with its shadow. With o only To-do list stays: the Media group closes. Enter flashes the item, the menu closes and the line becomes a checkbox, born small and settling on a spring; you type Ship the pricing page and the box gets ticked: it squashes, fills with the accent, the check draws itself and a line crosses the text, which turns grey. On a new line, slash with qx finds nothing: «No results» with a hint to try quote, table or code. Deleting a letter brings Quote back: Enter, and the line becomes a quote with its rule coming down from the top. Then /div and the line becomes a divider drawing itself from the left, and the caret moves to the next line. After a pause the page clears and starts again.

How it works

Items stay, they hide

The menu is built once: group headers and items stay in the DOM and on every letter they are hidden or put back in order with appendChild. A simple score orders the items left: the name starting with the query, then one of its words, then the name containing it, then a synonym, then the letters in scattered order.

FLIP, and a copy for those leaving

Before the change every visible item is measured; after it, every item left starts from its old place (y equal to the difference) and slides to zero. Those leaving can’t fade any more because they are hidden: a clone stays absolutely positioned in the same spot, fades and removes itself.

The window and the pill

The window’s height is measured before and after and animated between the two with back.out, then set back to auto. The pill is a single element under the items: it goes to the chosen item’s offsetTop, and if the item is out of the scrolling list the list scrolls just enough. The results count is two spans: the old one rises, the new one comes from below.

Real keys

A hidden text field receives the keys, so the keyboard opens on a phone: letters come from the input event, arrows, Enter, Esc and Backspace from keydown. The autopilot uses the same key function as real keys, with gsap.delayedCall for its timing, and stops at the first touch.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5b5bd6The colour of the typed slash, the matched letters and the Enter flash.
TYPE_GAPscript.js0.09The seconds between keys when the autopilot types.
OPEN_TIMEscript.js0.3The seconds the menu takes to open from the caret.
FLIP_TIMEscript.js0.36The seconds the remaining items take to slide into their new place.
PILL_TIMEscript.js0.26The seconds the pill takes to slide from item to item.
BOUNCEscript.js1.6How far the window overshoots its new height before settling: 0 for no bounce.
LOOP_PAUSEscript.js2.4The seconds the autopilot waits on the finished page before starting again.

Try them in the Playground

When to use it

For the editor of a notes, docs or project management app, a CMS or any field where different blocks can be inserted: typing a slash is the fastest way, and a menu that filters as you type makes it clear even to people who don’t know the shortcuts.

On phones

The same page, without the line of grey text: the menu opens above the line if there is no room below, the list scrolls inside the window and tapping the page opens the phone keyboard.

With reduced motion

Nothing slides or bounces: items change and the window takes its height at once, the pill jumps to the chosen item and the new blocks appear already in place.

Pitfalls

  • A hidden item can’t fade: to make it leave, an absolutely positioned clone is left in its place in the same list, and it disappears by itself.
  • A window with height: auto can’t be animated: it is measured before and after, animated between the two numbers and set back to auto at the end, otherwise the next filter stays at the old height.
  • The pill lives inside the scrolling list: it is positioned with offsetTop, which follows the scrolling, not with getBoundingClientRect.
  • color-mix doesn’t survive every engine: the slash’s pale ground is computed in the script from the accent colour.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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