Skip to content
animorio
IT
All components

Prompt template

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

An AI app’s prompt template in a card on white: one sentence with three coloured variables, tone, audience and length. Tapping a variable brings up its three options below; picking one changes the word inside the sentence, the slot takes its width and the text settles around it, and the token estimate counts to the new value. “Use prompt” sends the sentence to the chat.

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>
<!--
  "Prompt template" 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>Prompt template</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 prompt template of an AI app: the variables inside the sentence, the options of the one picked,
         the word changing in place, the token estimate and Use prompt -->
    <section class="pt" data-pt aria-label="Prompt template">
      <header class="pt__head"><strong>Launch email</strong><span class="pt__tok" title="Estimate: the prompt plus the reply it asks for">~<span data-outtok>178</span> tokens</span></header>
      <p class="pt__text" data-text>Write a <button type="button" class="pt__slot" data-slot="tone"><span data-word></span></button> launch email for <button type="button" class="pt__slot" data-slot="audience"><span data-word></span></button>, about <button type="button" class="pt__slot" data-slot="length"><span data-word></span></button> long.<span class="pt__slot pt__meas" data-meas aria-hidden="true"></span></p>
      <div class="pt__opts">
        <span class="pt__cap"><span data-outcap>Tone</span></span>
        <div class="pt__row" role="group" aria-label="Options" data-row>
          <i class="pt__pick" data-pick aria-hidden="true"></i>
          <button type="button" class="pt__opt" data-opt="0"><span></span></button>
          <button type="button" class="pt__opt" data-opt="1"><span></span></button>
          <button type="button" class="pt__opt" data-opt="2"><span></span></button>
        </div>
      </div>
      <button type="button" class="pt__use" data-use>
        <span class="pt__face" data-face="go">Use prompt<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.500 8h9M8.700 4.200 12.500 8l-3.800 3.800"></path></svg></span>
        <span class="pt__face" data-face="done"><svg viewBox="0 0 16 16" aria-hidden="true"><path pathLength="1" d="m3.600 8.400 2.900 2.900 5.900-6.600"></path></svg>Sent to chat</span>
      </button>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <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.

19 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 “Prompt template” 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 white, a rounded card: “Launch email” and on the right “~178 tokens”. Below, in a light grey box, the prompt’s sentence: “Write a friendly launch email for new customers, about 120 words long.”, with “friendly”, “new customers” and “120 words” in violet inside small slots. The picked variable has a violet outline, and under it you read its name, “Tone”, and its three options in a row, the active one on a white tile. Tapping “Formal” slides the tile, “friendly” leaves upwards and “formal” comes in from below, the slot narrows and the rest of the sentence settles; the token count drops by one. Tapping “new customers” in the sentence turns the options into the audience ones; with “200 words” the estimate counts up to 282. “Use prompt” presses in, turns violet with a tick and “Sent to chat”, the three variables answer one after the other, and two seconds later the button is back as it was.

How it works

The variables are buttons in the sentence

The sentence is a real paragraph; every variable is an inline button with its text inside. A list gives each variable its name, its three options and the words each puts in the sentence.

One row of options

The three buttons below are always the same: tapping a variable changes their labels, and the white tile, a third of the row wide, slides onto that variable’s active option.

The word changes in place

The new word is measured in a hidden slot with the same style, the slot’s width is animated from the old one to the new one, and meanwhile the old word leaves and the new one comes in. At the end the fixed width is removed.

The token estimate

About one token every four characters of the prompt, plus a token and a third for every word of the reply asked for. The number shown chases the computed one.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5b45e0The colour of the variables and of the button once sent.
ROLLscript.js0.5How many seconds the word takes to change in the sentence.
SPRINGscript.js1How much the word, the option tile and the button bounce.
LOOPscript.jstrueLeft alone, the demo’s pointer changes the three variables, uses the prompt and starts again.

Try them in the Playground

When to use it

In the prompt library of an AI app, in the copy generator of a marketing tool or on the empty screen of a chat, where people start from a template instead of a blank page; the same sentence with variables carries a search filter said in words, an automation rule or a report’s settings.

On phones

The card is at most 348 pixels wide and about 280 tall, and narrows with the screen. The sentence box is always three lines tall, so the card does not change height when the words get longer. The three options are 32 pixels tall and a third of the row wide; the button is 44 tall.

With reduced motion

No rolling words and no bounces: the new word is in place at once, the tile is already on the option, the token count changes in one step and the button fades to “Sent to chat” with the tick already drawn. The demo’s pointer does not start.

Pitfalls

  • The token estimate is a rule of thumb, not the real count: every model has its own tokenizer. In a real product the number comes from the service, and the label says it is an estimate.
  • The sentence box has a fixed height of three lines: with longer variables or a longer sentence it has to be raised, or the last line is cut.
  • Every variable carries “Change tone” in its aria-label, and every option the variable’s name (“Tone: Formal”): the same three words outside the sentence would not say what they are for. An aria-live region gives the choice made.
  • The template, the variables and the numbers are invented.

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 30 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