Skip to content
animorio
IT
Back to the library

Voice search bar

Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 9.2 KBGSAP 28 KBFreeDownload the zip

Searching for “voice search” turned up only voice buttons, no search bar: here is the voice search of a made-up clothing shop, Marlo, on warm white. Press the mic, the bar widens on a spring, the lens draws back and in place of the placeholder a waveform of thin lines follows the voice; the spoken words land in the field one at a time, blurred and then in focus, and two fix themselves (a grey “lining” becomes “linen”, “fifty” becomes “$50”). When the voice stops the waveform folds into a flat line, the words become three filter pills that drop under the bar and three result cards arrive. On hover a filter shows its x: remove “under $50” and the results reorder. Minimal style.

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>
<!--
  "Voice search bar" 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>Voice search bar</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 voice search of a made-up clothing shop, Marlo: the mic opens the bar, a waveform of thin lines follows the
         voice, the words land in the field one by one (some fix themselves), then turn into filter pills and three results -->
    <section class="app" data-app aria-label="Voice search">
      <p class="status" data-status aria-live="polite">Tap the mic and say what you need</p>

      <div class="bar" data-bar>
        <span class="bar__lens" data-lens aria-hidden="true">
          <svg viewBox="0 0 20 20"><circle cx="8.6" cy="8.6" r="5.4"></circle><path d="M12.6 12.6l4 4"></path></svg>
        </span>
        <div class="bar__field">
          <span class="bar__ph" data-ph>Search Marlo</span>
          <div class="bar__line" data-line>
            <span class="words" data-words></span>
            <span class="wave" data-wave aria-hidden="true"><span class="wave__bars" data-bars></span><span class="wave__flat" data-flat></span></span>
          </div>
        </div>
        <button class="mic" type="button" data-mic aria-label="Search by voice">
          <span class="mic__bg" aria-hidden="true"></span>
          <svg class="mic__icon" viewBox="0 0 20 20" aria-hidden="true"><rect x="7.2" y="2.6" width="5.6" height="9.4" rx="2.8"></rect><path d="M4.6 9.4a5.4 5.4 0 0 0 10.8 0M10 14.8v2.7"></path></svg>
        </button>
      </div>

      <div class="chips" data-chips aria-label="Filters"></div>

      <div class="results" data-results>
        <div class="results__head">
          <span class="results__count"><span data-count>18</span> results</span>
          <span class="results__sort">Relevance<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.4 4.8L6 7.4l2.6-2.6"></path></svg></span>
        </div>
        <ul class="grid" data-grid></ul>
      </div>
    </section>
  </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.

26 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Voice search bar” 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 warm white page, the white search bar of Marlo, a made-up clothing shop, with a soft layered shadow, the lens on the left, “Search Marlo” in grey and the mic in a sand-coloured circle; above it, a small line says “Tap the mic and say what you need”. The mic squeezes when pressed, turns red with a white icon and springs back; the bar widens on a spring and takes a faint red edge, the lens draws back and goes, the placeholder slides off as it blurs and the line above becomes “Listening” with a glint running through it. In place of the placeholder the waveform appears: nineteen thin red vertical lines that rise with every spoken word and drop in the pauses. The words land in the field one at a time, blurred and grey, come into focus and turn dark; “lining” stays grey and then turns into “linen”, “fifty” becomes “$50”, and the word widens or narrows with a bounce. When the voice stops the lines drop, merge into one flat line that draws away, the mic goes back to sand and the lens comes back with a little hop. The words flush red for a moment and from there the three filter pills drop, “linen”, “shirt”, “under $50”, each from the spot of its word, staggered and on a spring. The results arrive: “18 results”, “Relevance” and three cards with a woven linen swatch, the line drawing of a shirt, the name, the fabric and the price, staggered and coming into focus. On hover a pill widens on the wdth axis and shows its x; remove “under $50” and the pill shrinks away, its words leave the field, the cheapest card goes, the others slide across and the $78 Overshirt arrives first, while the count rolls to 41.

How it works

The bar that widens

The bar's width is calc(76% + 24% * var(--open)) and GSAP animates the --open variable from 0 to 1 with back.out: the spring goes just past a hundred percent and back, and the bar stays in percent at any window width.

The voice waveform

The lines are 22 pixel spans scaled with scaleY on every frame by GSAP's ticker: two sines per line, a bell envelope that raises the middle ones and a syllable that comes and goes. The timeline only animates two numbers, how visible the wave is and how loud the voice is.

The flat line, never dots

Lowered all the way, the lines would become dots: they go to zero while a one pixel horizontal line grows with scaleX from the middle, then draws away to the right.

Words that fix themselves

Each word is an inline-grid with the first guess and the fix in the same cell: the first rises and blurs, the second drops into focus, and the width goes from the measured width of one to the other with back.out, so the following words move with it.

Filters that drop from the words

When they drop, each filter's words and the pill in its place are measured with getBoundingClientRect: the pill starts from the offset between the two centres, small and transparent, and lands on a spring. With the price filter gone, the remaining cards are measured before and after and slide from the old spot to the new one.

Values to change

NameFileDefaultWhat it changes
SHOPscript.jsMarloThe shop name in the placeholder.
OPEN_SPRINGscript.js1.4How far the bar overshoots when it widens.
WORD_GAPscript.js0.62The time between one spoken word and the next.
BLURscript.js6How blurred the words are as they land.
WAVE_BARSscript.js19How many lines the voice waveform has.
WAVE_GAINscript.js1How high the lines rise with the voice.
CHIP_SPRINGscript.js1.6How much the filters bounce as they drop.
CARD_STAGGERscript.js0.09The stagger between one result card and the next.
LOOP_PAUSEscript.js2.4The pause once the search is done before the loop starts again.

Try them in the Playground

When to use it

In the header of an online shop or a marketplace, in a grocery or bookshop app, in a catalogue search where speaking beats typing, or in any search field that takes dictation.

On phones

The bar and the grid are in percent, the heights of the bar, the mic and the swatches also follow the height with clamp, and the waveform narrows with the width, so search, filters and three cards fit the phone preview box. Pills and reordering are measured afresh each time. On a phone the filters' x is always visible and touch replaces hover.

With reduced motion

No springs, waves or flights: the bar shows the finished search straight away, with the words, the three filters and the results in place; removing a filter fades out the pill and its words, the cards change without sliding and the self-running loop does not start.

Pitfalls

  • Waveform lines lowered almost to zero turned into dots: the minimum is a quarter of the height, and the wave ends through a horizontal line.
  • GSAP does not read percentages back from the CSS: the bar's width is animated through the --open variable, not width.
  • Pills measured only once at the start left from the wrong spot when the window changed height: words and pills are measured when they drop.
  • The fixed word changes width: without animating the cell's width, the following words jumped.
  • With hover only inside @media (hover: hover), the x would never show on a phone: with (hover: none) it is always visible.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 22 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 animations