AI Prompt Glow

A prompt box that lights up with a spinning rainbow edge while the assistant thinks, then streams the answer word by word. Pure CSS glow with @property.

Press the arrow button or Enter.

Download

What you can change

Change a number, save, and reload the page to see the difference.

1.8sspin

How long one full turn of the rainbow takes.

blur(14px)filter

Softness of the halo. Lower is sharper.

WORD_DELAY100

Milliseconds between streamed words.

Add it to your site

Use it on an AI chat, a search box or any place where users wait for an answer.

  1. CSS

    Paste into your stylesheet, or inside a <style> tag in <head>.

    @property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
    @keyframes spin { to { --angle: 360deg; } }
    
    .ai-card { position: relative; box-sizing: border-box; width: min(420px, 92vw); padding: 22px; border-radius: 28px; background: #0C0E15; isolation: isolate; }
    /* the halo behind the card: exactly the rule from the video */
    .ai-card::before, .ai-card::after { content: ""; position: absolute; z-index: -2; border-radius: inherit; opacity: 0; transition: opacity .5s cubic-bezier(.23, 1, .32, 1); }
    .ai-card::before { inset: -2px; }
    .ai-card::after { inset: -1.5px; }
    .thinking::before {
      background: conic-gradient(from var(--angle),
        #3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5);
      filter: blur(14px);
      animation: spin 1.8s linear infinite;
      opacity: .9;
    }
    /* a thin sharp edge on top of the halo, same colors */
    .thinking::after { background: conic-gradient(from var(--angle), #3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5); animation: spin 1.8s linear infinite; opacity: 1; }
    .ai-card .inner { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: #0C0E15; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
    .thinking.done::before { opacity: .25; }
    .thinking.done::after { opacity: .5; }
    
    .ai-card h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
    .ai-card .status { margin: 4px 0 18px; color: #7A8290; font-size: 12px; }
    .chat { min-height: 170px; display: flex; flex-direction: column; gap: 14px; }
    .bubble { align-self: flex-end; max-width: 80%; padding: 9px 14px; border-radius: 18px; background: #2A2F3D; font-size: 14px; animation: rise .45s cubic-bezier(.23, 1, .32, 1); }
    @keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
    .answer { margin: 0; font-size: 16px; line-height: 1.6; }
    .answer span { display: inline-block; white-space: pre; animation: word .35s cubic-bezier(.23, 1, .32, 1) both; }
    @keyframes word { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } }
    
    .prompt { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 6px 6px 6px 16px; border-radius: 26px; background: #141722; box-shadow: inset 0 0 0 1px rgba(141,107,255,.45); }
    .prompt input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: 500 15px system-ui, sans-serif; }
    .prompt input::placeholder { color: #5B6272; }
    .prompt button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #F3F5F8; color: #05060A; cursor: pointer; display: grid; place-items: center;
      transition: transform .12s cubic-bezier(.23, 1, .32, 1), opacity .2s ease; }
    .prompt button:active { transform: scale(.94); }
    .prompt button:disabled { opacity: .35; cursor: default; }
    .prompt:focus-within { box-shadow: inset 0 0 0 1.5px #8D6BFF; }
    .prompt button:focus-visible { outline: 2px solid #8D6BFF; outline-offset: 2px; }
    
    @media (prefers-reduced-motion: reduce) {
      .ai-card::before, .ai-card::after { animation: none; }
      .bubble, .answer span { animation: none; }
    }
  2. HTML

    Put it where the effect should appear on your page.

    <form class="ai-card">
      <div class="inner"></div>
      <h2>Assistant</h2>
      <p class="status">Ask anything</p>
      <div class="chat" aria-live="polite"></div>
      <label class="prompt">
        <input name="q" placeholder="Ask anything" autocomplete="off" value="Design a login that feels alive">
        <button aria-label="Send"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 13V3M3 8l5-5 5 5"/></svg></button>
      </label>
    </form>
  3. JavaScript

    Paste right before the closing </body> tag, inside <script></script>.

    const card = document.querySelector('.ai-card');
    const chat = card.querySelector('.chat');
    const status = card.querySelector('.status');
    const input = card.querySelector('input');
    const send = card.querySelector('button');
    const WORD_DELAY = 100;   // ms between streamed words
    
    // swap this for a real request, e.g. fetch('/api/ask', { method: 'POST', body: q })
    function fakeReply(q) {
      return new Promise(done => setTimeout(() => done('Split the button into two fields and let liquid metal stretch between them as they open.'), 1200));
    }
    
    card.onsubmit = async e => {
      e.preventDefault();
      const q = input.value.trim(); if (!q) return;
      chat.innerHTML = ''; input.value = ''; send.disabled = true;
    
      const bubble = document.createElement('div'); bubble.className = 'bubble'; bubble.textContent = q; chat.append(bubble);
      card.classList.remove('done');
      card.classList.add('thinking');
      status.textContent = 'Thinking…';
    
      const text = await fakeReply(q);
      status.textContent = 'Answer';
      const answer = document.createElement('p'); answer.className = 'answer'; chat.append(answer);
      const words = text.split(' ');
      for (const [i, w] of words.entries()) {
        const span = document.createElement('span'); span.textContent = w + (i < words.length - 1 ? ' ' : ''); answer.append(span);
        await new Promise(r => setTimeout(r, WORD_DELAY));
      }
      card.classList.add('done');
      send.disabled = false; input.focus();
    };

Connect it to your backend

Replace fakeReply() with a request to your own AI endpoint. The glow switches on and off by itself.

Good to know

Tilda, Webflow, WordPress

Press Copy all code at the top and paste it into one HTML block.

Tilda

Add block, Other, T123 HTML code. Paste and save. Check the published page, the editor preview does not run scripts.

Webflow

Add panel, Embed. Paste, then Save & Close. Custom code runs on the published site.

WordPress

Add block, Custom HTML. Paste and press Update.

More in Hero & landing

See all
Copied