Skip to content
animorio
IT
All components

Glass prompt field

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

The prompt field of Vela, a made-up AI workspace, in dark glass with a one pixel edge that catches the light and an indigo and cyan glow underneath. While it is empty, five example prompts take turns inside it: the words rise staggered out of a blur, the old line leaves upwards blurring away and a thin ring around the Tab key counts the time. With the pointer over it the suggestion holds; with a click or Tab its words turn white where they are and become the text. Sent, the text shimmers, a beam runs round the edge and the button loads, then the words fly off and a check arrives.

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>
<!--
  "Glass prompt field" 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 glass prompt field with suggestions that take turns</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" data-stage>
    <!-- the prompt field of a made-up AI workspace, Vela: dark glass with a one pixel edge that catches the light, a
         controlled glow underneath. Five example prompts take turns inside the empty field: the words rise one after
         the other, the old line leaves upwards in a blur. Hover holds the line, a click or Tab puts it in the field -->
    <div class="wrap" data-wrap>
      <span class="glow" data-glow aria-hidden="true"><span class="glow__a"></span><span class="glow__b"></span></span>
      <form class="field" data-field autocomplete="off">
        <span class="field__glass" aria-hidden="true"></span>
        <span class="field__sheen" data-sheen aria-hidden="true"></span>
        <span class="field__edge" data-edge aria-hidden="true"></span>
        <span class="field__beam" data-beam aria-hidden="true"></span>

        <div class="field__area">
          <label class="sr" for="prompt">Ask Vela anything</label>
          <textarea class="field__input" id="prompt" rows="2" data-input aria-describedby="hint-now"></textarea>
          <div class="hint" data-hint>
            <button class="hint__btn" type="button" data-hint-btn tabindex="-1">
              <span class="hint__line" data-line></span>
              <span class="hint__line" data-line></span>
            </button>
          </div>
          <p class="sr" id="hint-now" data-hint-now></p>
        </div>

        <div class="bar">
          <div class="bar__left">
            <button class="tool" type="button" aria-label="Attach a file">
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3.2v9.6M3.2 8h9.6"/></svg>
            </button>
            <button class="model" type="button" aria-label="Model: Vela 3">
              <svg class="model__star" data-star viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.6c.5 3.3 3.1 5.9 6.4 6.4-3.3.5-5.9 3.1-6.4 6.4-.5-3.3-3.1-5.9-6.4-6.4 3.3-.5 5.9-3.1 6.4-6.4Z"/></svg>
              <span data-model>Vela 3</span>
              <svg class="model__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="m5 6.6 3 3 3-3"/></svg>
            </button>
          </div>
          <div class="bar__right">
            <span class="use" data-use aria-hidden="true">
              <span class="use__swap">
                <span class="use__idle" data-use-idle>
                  <span class="key" data-key>
                    <svg class="key__ring" viewBox="0 0 36 22" preserveAspectRatio="none"><rect class="key__track" x="0.6" y="0.6" width="34.8" height="20.8" rx="6"/><rect class="key__fill" data-timer x="0.6" y="0.6" width="34.8" height="20.8" rx="6" pathLength="1"/></svg>
                    <span class="key__cap" data-keycap>Tab</span>
                  </span>
                  <span class="use__word">to use</span>
                </span>
                <span class="use__busy" data-use-busy>Thinking</span>
              </span>
            </span>
            <button class="send" type="submit" data-send aria-label="Send" disabled>
              <span class="send__face" data-send-face>
                <svg class="send__icon" viewBox="0 0 16 16" aria-hidden="true">
                  <path class="send__arrow" data-arrow d="M8 12.6V3.6M4.2 7.2 8 3.4l3.8 3.8"/>
                  <circle class="send__spin" data-spin cx="8" cy="8" r="6" pathLength="1"/>
                  <path class="send__check" data-check pathLength="1" d="M4 8.4l2.7 2.7L12 5.6"/>
                </svg>
              </span>
            </button>
          </div>
        </div>
      </form>
    </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>

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.

30 values to change

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 “Glass prompt field” 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 page, with a faint indigo light and a very fine grain, there is only the prompt field of Vela, a made-up AI workspace: a dark glass box with round corners, its one pixel edge brighter at the top, and underneath a soft indigo and cyan glow. A light drifts slowly along the edge, and with a mouse it follows the pointer on a spring. Inside, while the field is empty, five example prompts take turns, like Summarize this week’s sales calls: the words rise one after the other out of a blur with a small settle, and when the new line arrives the old one rises and blurs away. At the bottom there are the plus to attach, the Vela 3 model pill with its star turning a quarter at every change and, on the right, the Tab key with a thin ring that fills while the suggestion stays, next to to use, and the round send button, off. With the pointer over it, the suggestion brightens and holds, and the ring waits. With a click or Tab the key goes down, the words turn white where they are, the edge catches the light and the text is in the field, ready to edit; the send button turns white with a bounce. Pressed, the arrow rises and disappears, a spinning arc comes in, an indigo and white beam runs round the edge, the glow underneath grows, to use becomes a shimmering Thinking and a shimmer crosses the text. Then the words fly off upwards blurring away, the button turns indigo and draws a check, and the suggestions start again. By itself it goes round: every second suggestion is held, taken with Tab and sent.

How it works

The glass in layers

The field is a form with four absolute layers under the text: the glass with a vertical gradient and backdrop-filter, a barely visible radial sheen under the pointer, the edge and the beam. The edge is a one pixel ring cut out with mask-composite (1px padding and two linear-gradients), painted with a light from above and a radial-gradient sitting at --mx and --my; a gsap.quickTo on an object brings the light after the pointer on a spring, and without a mouse it drifts slowly along the top edge.

The words taking turns

Two absolute lines sit exactly over the textarea, with the same font, size and line height. Each suggestion is split into inline-block words separated by real spaces, so it wraps like the real text; the words rise from fourteen pixels and out of a blur with back.out and a stagger, while those of the old line rise and blur with power2.in. The two lines swap at every turn.

The time on the Tab key

Around the Tab key there is an SVG rectangle with pathLength 1: a stroke-dashoffset tween from 1 to 0 as long as the suggestion stays, which calls the next one when it ends. The pointer over the line pauses it and resumes it on the way out, so the time left is not lost.

The suggestion that becomes text

With a click or Tab (caught in the textarea only when it is empty) the words go from grey to white where they are with a small elastic settle; at the end the value goes into the textarea and the lines hide in the same frame, and since they sit in the same place the swap does not show.

Sending and loading

The sent text goes back into the lines and takes a shimmer: each word has two backgrounds clipped to the text, the colour and a light band, and the band is shifted by minus its offsetLeft, so a single --sx variable animated on the line sweeps it across the whole sentence. Meanwhile a conic-gradient in the same ring as the edge spins with the --a variable, the button’s arc spins with svgOrigin and the glow grows; after the wait the words fly off and the button draws the check.

Values to change

NameFileDefaultWhat it changes
IDEASscript.js5 promptThe five example prompts that take turns in the field.
DWELLscript.js3.2The seconds each suggestion stays in the field.
STAGGERscript.js0.05The seconds between one word and the next as they rise.
RISEscript.js14The pixels the words rise from.
BLURscript.js8The pixels of blur of the line that leaves.
THINKscript.js2.4The seconds of loading after sending.
MODELscript.js'Vela 3'The model written in the bar.
AUTOscript.jstrueWhether it goes round by itself until someone touches it.

Try them in the Playground

When to use it

For the main box of an AI app, an assistant, an internal search or a dashboard: it shows what can be asked without filling the page with pills, an example is picked with a click or Tab, and it clearly says the request is loading.

On phones

On the phone the field is 92% of the screen wide and long suggestions wrap onto two lines; the to use words go and the key with its ring stays; there is no hover, so you tap the suggestion to pick it and the light on the edge drifts by itself.

With reduced motion

Nothing moves: the lines swap with a fade without rising or blurring, the light on the edge stays still, loading is the still arc and the text fading lighter and darker, and the check draws itself.

Pitfalls

  • Inline-block words stuck together did not wrap like the textarea: between one word and the next a real space is needed as a text node, otherwise the suggestion and the chosen text wrap in different places and the line jumps at the swap.
  • The shimmer with background-clip: text on each word started one band per word, all at once: the band has to be shifted by minus the word’s offsetLeft (--ox), so a single --sx on the line sweeps it across the whole sentence; on resize --ox is recomputed.
  • Always catching Tab took the keyboard away from anyone who wanted to leave the field: it is caught only when the field is empty and there is a suggestion, and never with Shift.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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