
The elastic button
Buttons, Hover, Text
The docs search of Cobble, a small team's knowledge base, on white, in the premium style of Dribbble shots: the word types itself, a thin light runs under the field while it looks, then the results arrive grouped by folder. One folder at a time opens like an accordion on a spring, the matched letters get a yellow highlighter stroke that sweeps in from the left with a glint, and the selection is a small indigo plate gliding from row to row while the keys in the footer press down.
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>
<!--
"Accordion document 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 document search with results grouped in an accordion</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">
<!-- the search of Cobble, the docs of a small team: the query types itself, a thin light runs under the field
while it looks, then the results arrive grouped by folder. One group at a time opens like an accordion and the
matched word is marked with a highlighter stroke that sweeps in. The selection glides from row to row on a
spring and the keys in the footer press as they are used -->
<div class="wrap" data-wrap>
<section class="card" data-card role="search" aria-label="Search the team docs">
<i class="card__grain" aria-hidden="true"></i>
<i class="card__sheen" aria-hidden="true"></i>
<div class="field" data-field>
<svg class="field__lens" data-lens viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.6" cy="8.6" r="5.4"/><path d="M12.6 12.6l4.2 4.2"/></svg>
<span class="field__type">
<label class="sr" for="doc-q">Search the docs</label>
<input class="field__input" id="doc-q" type="text" autocomplete="off" spellcheck="false" placeholder="Search Cobble docs" data-input aria-controls="doc-list" aria-autocomplete="list">
<span class="field__caret" data-caret aria-hidden="true"></span>
<span class="field__measure" data-measure aria-hidden="true"></span>
</span>
<button class="field__clear" type="button" data-clear aria-label="Clear the search">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M6.5 6.5l7 7M13.5 6.5l-7 7"/></svg>
</button>
<i class="field__beam" data-beam aria-hidden="true"></i>
</div>
<div class="sum" aria-hidden="true">
<span class="sum__count"><span class="roll" data-roll><span class="roll__n" data-roll-n>0</span></span> <span data-sum-word>results</span></span>
<span class="sum__in" data-sum-in>in 0 folders</span>
</div>
<div class="list" id="doc-list" data-list role="listbox" aria-label="Results">
<i class="pick" data-pick aria-hidden="true"></i>
<div class="groups" data-groups></div>
<p class="empty" data-empty>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 3.5h7l4 4v13H7z"/><path d="M14 3.5v4h4"/><path d="M10 13.5h5M10 16.5h3"/></svg>
<span>No documents match <q data-empty-q></q></span>
</p>
</div>
<footer class="foot" aria-hidden="true">
<span class="hint"><kbd class="key" data-key="up"><svg viewBox="0 0 12 12"><path d="M6 9.2V2.8M3.2 5.6L6 2.8l2.8 2.8"/></svg></kbd><kbd class="key" data-key="down"><svg viewBox="0 0 12 12"><path d="M6 2.8v6.4M3.2 6.4L6 9.2l2.8-2.8"/></svg></kbd><span class="hint__w">move</span></span>
<span class="hint"><kbd class="key key--wide" data-key="enter"><svg viewBox="0 0 16 12"><path d="M12.6 2.6v3.6a1.6 1.6 0 0 1-1.6 1.6H3.6M6 5.4L3.6 7.8 6 10.2"/></svg></kbd><span class="hint__w">open</span></span>
<span class="hint"><kbd class="key key--wide" data-key="esc"><span>esc</span></kbd><span class="hint__w">clear</span></span>
</footer>
</section>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
28 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 “Accordion document search” from Animorio and fit it into my siteThe documents are a list of objects with folder, title, line and date. A regex looks for the word at the start of a word, in the title and in the line, the matches are grouped in a Map by folder and the folders are sorted fullest first; three remain, with three documents at most.
Each folder has a body zero high with hidden overflow: opening it GSAP takes it from zero to height auto with a damped spring written as an ease (it passes the mark once and lands exactly on 1), the rows rise staggered and the chevron turns 90 degrees on the same spring. Opening a folder closes the others.
The matched letters are wrapped in a span holding an absolute yellow mark, multiplied under the text: it grows with scaleX from the left, staggered between title and line, then a white gradient in background-position runs over it once like a glint of fresh ink.
The selection is one element under the rows. Every frame the picked row is measured and four springs (x, y, width, height), integrated by hand in two steps, chase it: so it follows the row even while the accordion opens and closes underneath.
The loop on its own is a GSAP timeline of calls using the same functions as the keyboard (move, enter, clear), so the footer keys really press. A tap, a key or the wheel from the person stops the pilot and the search is theirs.
| Name | File | Default | What it changes |
|---|---|---|---|
QUERY_A | script.js | refund | The first word the field types by itself. |
QUERY_B | script.js | onboarding | The second word the field types by itself. |
TYPING | script.js | 11 | How many letters per second the field types by itself. |
LOOK | script.js | 0.5 | How many seconds the light runs under the field before the results arrive. |
OPEN | script.js | 0.62 | How many seconds a folder takes to open like an accordion. |
SPRING | script.js | 1 | How springy the folders and rows are: 0.5 calm, 2 very bouncy. |
MARKER | script.js | 0.42 | How many seconds the highlighter takes to sweep over a word. |
GLIDE | script.js | 320 | The stiffness of the spring the selection glides on: higher is quicker. |
AUTO | script.js | true | Searches, browses and opens by itself until someone touches the card. |
For the search of a documentation site, a help centre, an internal wiki, a notes app or a back office: wherever results come from different places and are best seen by folder, with the found word highlighted and a keyboard that works.
The same animation with adapted sizes: the card is almost as wide as the screen and at most as tall as the window, rows and folders get shorter with the height, the Esc hint in the footer hides below 420 pixels. With a finger tap a folder to open it and a row to open it.
Nothing moves: folders and rows fade in, the accordion opens without a spring, the highlighter is already laid down and fades in, the selection jumps to the row without gliding and the count changes in place.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 13 KB; the libraries: GSAP 28 KB.
Tested on 6 November 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.