
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteThe 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.
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’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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #5b5bd6 | The colour of the typed slash, the matched letters and the Enter flash. |
TYPE_GAP | script.js | 0.09 | The seconds between keys when the autopilot types. |
OPEN_TIME | script.js | 0.3 | The seconds the menu takes to open from the caret. |
FLIP_TIME | script.js | 0.36 | The seconds the remaining items take to slide into their new place. |
PILL_TIME | script.js | 0.26 | The seconds the pill takes to slide from item to item. |
BOUNCE | script.js | 1.6 | How far the window overshoots its new height before settling: 0 for no bounce. |
LOOP_PAUSE | script.js | 2.4 | The seconds the autopilot waits on the finished page before starting again. |
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.
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.
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.
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.
Tested on 26 October 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.