
The elastic button
Buttons, Hover, Text
The mail search of Larkmail, on white, in the style of real product interface pieces: typing from: or is: opens a small menu of suggestions, and the pick folds the typed text into a token that grows with a spring. Below, the messages that do not fit close up, the ones left close ranks with a small settle and the results count rolls.
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>
<!--
"Token filter search" 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 search with filters that turn into tokens 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>
<!-- the search of a mail app: typing from: or is: opens a small menu, the pick folds the typed text into a token,
the list below filters itself while the count rolls -->
<section class="box" data-card aria-label="Larkmail search">
<header class="box__head">
<svg class="box__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M3.5 8.5 12 14l8.5-5.5"></path><rect x="3.5" y="5.5" width="17" height="13" rx="2.5"></rect></svg>
<p class="box__brand">Larkmail <span>/ Inbox</span></p>
<p class="box__count" aria-live="polite"><span class="roll" data-count><span class="roll__in">6</span></span> <span data-count-word>results</span></p>
</header>
<div class="search" data-search>
<svg class="search__lens" viewBox="0 0 24 24" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6"></circle><path d="m15 15 4.5 4.5"></path></svg>
<div class="search__line" data-line>
<input class="search__input" data-input type="text" autocomplete="off" spellcheck="false" placeholder="Search, or try from: and is:" aria-label="Search mail">
</div>
<span class="search__measure" data-measure aria-hidden="true"></span>
<div class="menu" data-menu role="listbox" aria-label="Suggestions"></div>
</div>
<ul class="list" data-list></ul>
<p class="empty" data-empty>No messages match these filters.</p>
</section>
<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>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.
17 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 “Token filter search” from Animorio and fit it into my siteThe field is a real input in a flexible row: the tokens are spans placed before the input, so the caret always starts again after the last token and keyboard, paste and screen readers work as in any field.
On every letter a rule looks for from: or is: at the start of the text; if it is there, the menu is rebuilt with the items containing what follows the colon, and the found letters go into a blue mark.
Before the field is emptied a hidden span measures how wide the typed text was: the new token starts from that width and reaches its own with back.out, while the input, pushed right, comes back with the same spring.
Each row remembers whether it is visible: the leaving ones go to zero height sliding 10 pixels, the returning ones start from zero and reach the measured height, and the ones that stay settle by two pixels once the others are done.
The number sits in a window one line tall: the new one comes in from above or below depending on whether the results grow or shrink, the old one leaves the other way, and the number does a small elastic bounce.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #3b5bfd | The colour of the focused field, the tokens and the found letters. |
TYPE_SPEED | script.js | 0.09 | The seconds between letters when the autopilot types. |
SPRING | script.js | 1.8 | How far the token goes past its size before settling (0 = no spring). |
ROW_TIME | script.js | 0.38 | The seconds a result row takes to close or open again. |
PAUSE | script.js | 1.1 | The seconds the autopilot waits between gestures. |
For the search of an inbox, a project tracker or a dashboard with many items, wherever filters should be typed without leaving the keyboard.
The card takes the full width minus the margins; below 380 pixels the time of the messages disappears and the star stays, and when the window is short the rows drop to 38 pixels. A tap picks from the menu like a click.
No springs and no sliding: the menu, the tokens and the rows appear and disappear with short fades, the count changes without rolling and the drawn pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.4 KB; the libraries: GSAP 28 KB.
Tested on 27 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.