Skip to content

AI Ask Mode

A copy-paste command palette component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Command PaletteHTMLCSSany framework

Copy into your project

HTML
<!-- AI Ask Mode — streaming dots while an answer is generated -->
<div class="nuda-cp2-ask-ai" role="dialog" aria-label="Ask AI">
  <div class="nuda-cp2-ask-ai__query">
    <span class="nuda-cp2-ask-ai__badge" aria-hidden="true">AI</span>
    How do I reset my password?
  </div>
  <div class="nuda-cp2-ask-ai__answer" role="status" aria-live="polite" aria-label="Generating answer">
    <span class="nuda-cp2-ask-ai__dot"></span>
    <span class="nuda-cp2-ask-ai__dot"></span>
    <span class="nuda-cp2-ask-ai__dot"></span>
  </div>
</div>
CSS
.nuda-cp2-ask-ai {
  width: 280px;
  background: #161616;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 12px;
  animation: nuda-cp2-ask-ai-in .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 16px 40px -8px rgba(0,0,0,.6);
}

.nuda-cp2-ask-ai__query {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 12px ui-sans-serif,system-ui;
  color: #cfcfcf;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.nuda-cp2-ask-ai__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #e4ff54;
  color: #0a0a0a;
  font: 800 9px ui-sans-serif,system-ui;
}

.nuda-cp2-ask-ai__answer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 2px 2px;
}

.nuda-cp2-ask-ai__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e4ff54;
  animation: nuda-cp2-ask-ai-bounce 1.2s ease-in-out infinite;
}

.nuda-cp2-ask-ai__dot:nth-child(2) {
  animation-delay: .15s;
}

.nuda-cp2-ask-ai__dot:nth-child(3) {
  animation-delay: .3s;
}

@keyframes nuda-cp2-ask-ai-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes nuda-cp2-ask-ai-bounce {
  0%,60%,100% {
    transform: translateY(0);
    opacity: .5;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-cp2-ask-ai,.nuda-cp2-ask-ai__dot {
    animation: none !important;
  }
  .nuda-cp2-ask-ai__dot {
    opacity: 1;
  }
}

How to use AI Ask Mode

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More command palette components

← Browse all NudaUI components