Skip to content
animorio
IT
Back to the library

SQL query editor

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

The query editor of a data tool. Pick a saved query and the text writes itself, keywords, strings and numbers each in their colour; then Run fires, a line of light sweeps under the editor and the result rows drop in one after the other. Point at a column, in the query or in the table, and it lights up in both.

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>
<!--
  "SQL query editor" 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>SQL query editor</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">
    <!-- a SQL editor: the saved query writes itself in colour, Run sweeps a line and the rows drop in;
         a column lights up together in the query and in the result, whichever of the two you point at -->
    <section class="sq" data-sq aria-label="SQL query editor">
      <div class="sq__tabs" data-tabs role="group" aria-label="Saved queries"></div>

      <div class="sq__editor">
        <pre class="sq__code" data-code aria-label="Query"></pre>
        <button class="sq__run" type="button" data-run>
          <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.500 2.300v7.400L9.600 6Z"></path></svg>
          <span class="sq__roll"><span data-runlabel>Run</span></span>
        </button>
        <span class="sq__sweep" data-sweep aria-hidden="true"></span>
      </div>

      <div class="sq__table" data-table role="table" aria-label="Result"></div>

      <footer class="sq__foot"><span data-foot aria-live="polite"></span></footer>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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>

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.

14 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 “SQL query editor” 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 near-black ground, a dark card. At the top three saved queries: Top customers, Signups, Failed payments. Below, the editor: four monospaced lines that write themselves letter by letter with the cyan caret at the end, SELECT and FROM in violet, strings in green, numbers in orange. When the writing is done the Run button says “Running”, a line of light crosses the bottom of the editor and in the table below the header and four rows drop in, one after the other with a small bounce; at the foot the count, “4 rows · 12 ms”. Hover a column name in the query (spend) and that word lights up, and with it the whole column in the table; hover the header and the reverse happens. Change query and the table empties, the text is rewritten and the result returns.

How it works

The query in pieces

A regular expression splits the text into strings, numbers, words and the rest. Each word is a keyword, a result column (and then carries its number) or plain text.

Typing without losing the colours

A tween takes a number from zero to the query’s length; at every step the first n characters are shown, piece by piece, so even a half-written word already has its colour.

Run

The line of light is a gradient crossing the editor for as long as the answer takes; then the table is rebuilt and the rows come in staggered.

The column in two places

The word in the query, the header and the cells share one attribute with the column number: a single pointerover listener on the card lights every element with that number.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5ad4e6The colour of the caret, the sweeping line and the lit column.
SPEEDscript.js60How many characters a second are typed when a saved query opens.
LATENCYscript.js0.6How many seconds the query takes to answer after Run.
STAGGERscript.js0.07How many seconds pass between one result row and the next.
LOOPscript.jstrueLeft alone, the demo’s pointer points at two columns and opens the other two queries.

Try them in the Playground

When to use it

On the landing page of a database, an analytics tool or an admin panel, to show in ten seconds how it is queried; in documentation, beside a sample query.

On phones

The same card, as wide as the screen: the query lines are short on purpose and do not wrap, the three columns tighten and long text truncates with an ellipsis. With a finger the columns do not light on hover.

With reduced motion

The query is already written and the result already in the table; on a new query the text and rows change at once, with no typing or dropping. Columns still light up. The demo does not move by itself.

Pitfalls

  • There is no database here: queries, rows and milliseconds are made up. With real data the text is a real editor (a textarea or CodeMirror) and the rows come from the server.
  • Rewriting innerHTML on every character is fine for four lines; for long text append only the new piece.
  • The pre has a fixed height of four lines: without it the card grows while the text is typed and everything else shifts.
  • Pressing Run while the text is still being typed completes it at once instead of running half a query.
  • Words equal to a column light up wherever they appear in the query, inside WHERE and ORDER BY too: on purpose, it shows where the column is used.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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