Skip to content

Cmd-K Trigger

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

Command PaletteHTMLCSSany framework

Copy into your project

HTML
<!-- Cmd-K Trigger — opens the command palette -->
<button class="nuda-cmdkbtn" type="button">
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
       stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <circle cx="11" cy="11" r="7" />
    <path d="M21 21 L16 16" />
  </svg>
  <span class="nuda-cmdkbtn__text">Search…</span>
  <span class="nuda-cmdkbtn__kbd"><kbd>⌘</kbd><kbd>K</kbd></span>
</button>
CSS
/* Cmd-K Trigger
   Subtle search-like button with a keyboard shortcut hint.
   Customize: --cmdk-accent */

.nuda-cmdkbtn {
  --cmdk-accent: #e4ff54;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #a1a1aa;
  font: 500 0.875rem ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  min-width: 240px;
}

.nuda-cmdkbtn:hover {
  border-color: rgba(228, 255, 84, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #fafafa;
}

.nuda-cmdkbtn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.nuda-cmdkbtn__text {
  flex: 1;
  text-align: left;
}

.nuda-cmdkbtn__kbd {
  display: inline-flex;
  gap: 3px;
}

.nuda-cmdkbtn__kbd kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  font: 700 0.65rem ui-monospace, monospace;
  color: #a1a1aa;
  line-height: 1;
}

How to use Cmd-K Trigger

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