Skip to content
animorio
IT
All components

Tool call card

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

The tool call block of Juniper, Kestrel’s made-up travel agent, inside the chat: asked for a flight to Lisbon, the agent calls search_flights and the card writes its arguments as tidy JSON, keys in grey and values in violet, then asks for permission with Approve and Deny. Once approved the spinner turns and a thin line runs under the header while the seconds count; at «Done · 1.2s» the tick draws itself in the circle, the arguments fold into a single line and three flights spring open below, the cheapest one marked. The header folds and unfolds the card. On white, with a single violet accent.

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>
<!--
  "Tool call card" 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>Tool call card</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- a chat with Juniper, the made-up travel agent of Kestrel: the user asks for a flight,
         the agent calls a tool. The tool call card writes its arguments, asks for approval,
         runs, and opens its result; a click on the header folds it -->
    <section class="chat" data-chat aria-label="Chat with Juniper, the Kestrel travel agent">
      <div class="msg msg--user" data-user>
        <p>Find me a flight to Lisbon on Friday, under €200.</p>
      </div>

      <article class="tool" data-tool>
        <span class="tool__light" aria-hidden="true"></span>
        <button class="head" type="button" data-head aria-expanded="true" aria-controls="tool-body">
          <span class="head__ico" aria-hidden="true">
            <svg viewBox="0 0 24 24"><path d="M17.8 19.2L16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"/></svg>
          </span>
          <span class="head__name">
            <code>search_flights</code>
            <span class="head__src">Kestrel Flights</span>
          </span>
          <span class="state" data-state>
            <span class="state__ico" aria-hidden="true">
              <svg class="i-wait" data-i="wait" viewBox="0 0 20 20"><circle cx="10" cy="10" r="6.6"/><path d="M10 6.6V10l2.2 1.6"/></svg>
              <svg class="i-spin" data-i="spin" viewBox="0 0 20 20"><circle class="spin__track" cx="10" cy="10" r="6.6"/><circle class="spin__arc" cx="10" cy="10" r="6.6" pathLength="1"/></svg>
              <svg class="i-done" data-i="done" viewBox="0 0 20 20"><circle cx="10" cy="10" r="7.4"/><path class="tick" d="M6.8 10.2l2.2 2.2 4.3-4.6" pathLength="1"/></svg>
              <svg class="i-no" data-i="no" viewBox="0 0 20 20"><circle cx="10" cy="10" r="7.4"/><path class="cross" d="M7.4 7.4l5.2 5.2M12.6 7.4l-5.2 5.2" pathLength="1"/></svg>
            </span>
            <span class="state__txt" data-state-txt>Needs approval</span>
          </span>
          <svg class="chev" data-chev viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2L8 9.8l3.5-3.6"/></svg>
        </button>
        <span class="run" aria-hidden="true"><span class="run__bar" data-run></span></span>

        <div class="body" id="tool-body" data-body>
          <div class="body__in">
            <pre class="args" data-args aria-label="Arguments"></pre>
            <p class="summary" data-summary aria-hidden="true">
              <span>LHR</span>
              <svg viewBox="0 0 16 10"><path d="M1 5h13M10.4 1.6L14 5l-3.6 3.4"/></svg>
              <span>LIS</span><span class="sep">·</span><span>Fri 4 Dec</span><span class="sep">·</span><span>under €200</span>
            </p>
            <div class="ask" data-ask>
              <p class="ask__q">Allow <b>Juniper</b> to search flights?</p>
              <div class="ask__btns">
                <button class="btn btn--ghost" type="button" data-deny><span>Deny</span></button>
                <button class="btn btn--go" type="button" data-approve data-autoclic><span>Approve</span></button>
              </div>
            </div>
            <ul class="results" data-results aria-label="Result">
              <li class="row">
                <span class="row__tag" aria-hidden="true"><span>TP</span></span>
                <span class="row__main"><b>07:10 – 09:45</b><span>TAP Air Portugal · Direct</span></span>
                <span class="row__price">€148</span>
              </li>
              <li class="row row--best">
                <span class="row__tag" aria-hidden="true"><span>U2</span></span>
                <span class="row__main"><b>11:35 – 14:10</b><span>easyJet · Direct</span></span>
                <span class="row__price">€96<span class="best">Cheapest</span></span>
              </li>
              <li class="row">
                <span class="row__tag" aria-hidden="true"><span>BA</span></span>
                <span class="row__main"><b>17:20 – 19:55</b><span>British Airways · Direct</span></span>
                <span class="row__price">€184</span>
              </li>
            </ul>
          </div>
        </div>
      </article>

      <div class="msg msg--ai" data-reply>
        <span class="msg__who" aria-hidden="true">
          <svg viewBox="0 0 20 20"><path d="M10 2.6c.5 3.9 3.5 6.9 7.4 7.4-3.9.5-6.9 3.5-7.4 7.4-.5-3.9-3.5-6.9-7.4-7.4 3.9-.5 6.9-3.5 7.4-7.4z"/></svg>
        </span>
        <p data-reply-txt></p>
      </div>
      <p class="sr" aria-live="polite" data-live></p>
    </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.

44 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 “Tool call card” 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

A chat with Juniper, Kestrel’s agent: the question arrives in the grey bubble («Find me a flight to Lisbon on Friday, under €200.»), below it the tool call card springs in, with the plane icon, search_flights in a monospace face and Kestrel Flights. The arguments are written one character at a time with a blinking caret; then the state turns «Needs approval» and Approve and Deny rise in. Approve sinks to 0.95 and comes back on an elastic, the question folds away and the card gets shorter; the spinner turns in place, a violet line runs under the header and «Running» counts the tenths. At the end the violet circle springs in, the tick draws itself, a light crosses the card, the arguments fold into «LHR → LIS · Fri 4 Dec · under €200» and the three flights rise one after another, with easyJet at €96 marked «Cheapest». Juniper answers word by word. Deny stops everything with a cross and a kind reply; a click on the header folds and unfolds the card. When nobody touches it, the demo plays by itself.

How it works

Arguments in pieces

The JSON is a list of lines made of pieces (key, value, punctuation), each with its colour class. To write it, a character count is animated from 0 to the total and at every step the HTML up to there is rebuilt, with the caret at the end: the colours are there while it types.

The height follows

Every change of the card (the question leaving, the arguments becoming one line, the flights arriving) goes through one function: it measures the height before, changes the content, measures the new height and animates it on a spring, then sets it back to auto.

State from one centre

The four state icons (waiting, spinner, tick, cross) are stacked svgs in a fixed square: they swap with a fade and a scale from their centre, so nothing shifts. The spinner turns the whole svg with transformOrigin 50% 50%.

The tick that draws itself

Tick and cross have pathLength 1 and stroke-dashoffset from 1 to 0; autoRound is off, otherwise GSAP would round to pixels and the tick would pop in at once.

Values to change

NameFileDefaultWhat it changes
TYPE_SPEEDscript.js48Characters per second while the agent writes the arguments.
RUN_TIMEscript.js1.2Seconds the tool runs before the result comes back.
SPRINGscript.js0.7How springy the card is when it opens and changes (lower = more bounce).
AUTO_APPROVEscript.js1.6Seconds of waiting before the demo approves by itself.
AUTO_PAUSEscript.js5Seconds of quiet before the demo starts over.

Try them in the Playground

When to use it

In apps with an AI assistant or agent that uses tools and connectors (MCP): it shows what it is about to do, asks for permission, says when it is working and how long it takes, and lets you read the result without flooding the chat.

On phones

Everything is in em and the size depends on both the width and the height of the window; once the flights arrive the arguments become a single line, so the card stays short even in the phone box. A tap works like a click.

With reduced motion

No springs or movement: the arguments appear whole, the spinner doesn’t turn and the line doesn’t run, the icons, the flights and the reply fade in.

Pitfalls

  • The spinner is the whole svg turning: it needs transformOrigin 50% 50%, never svgOrigin, which would move the pivot on the svg.
  • The state text changes width (Needs approval, Running, Done): it sits in an auto column on the right and the icon in a fixed square, so the icon never leaves its centre.
  • To animate the height of changing content, measure before and after with height auto: GSAP can’t tween from auto to auto.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

Tested on 29 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 components