Library MCP Setup About Template Factory ↗
← Library / Overlays UI SDK Agentic

Command Quick Bar

Native UI SDK Command palette with built-in filtering, arrow-key navigation, keyboard shortcuts, and full createAgent().query() + act() support.

Install UI SDK & packages

npm install @ui-sdk/react @ui-sdk/core lucide-react

Give your agent the UI SDK skill

npx skills add vercel-labs/ui --skill ui-sdk

UI SDK entries: @ui-sdk/react/command
"use client";

import * as React from "react";
import { Copy, FolderPlus, Rocket, Search, Users } from "lucide-react";
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandGroupLabel,
  CommandInput,
  CommandItem,
  CommandItemIcon,
  CommandList,
  CommandShortcut,
} from "@ui-sdk/react/command";

const COMMANDS = [
  { value: "new-project", label: "Create new project", group: "Workspace", shortcut: "mod+n", icon: FolderPlus },
  { value: "invite", label: "Invite team member", group: "Workspace", shortcut: "mod+i", icon: Users },
  { value: "copy-mcp", label: "Copy MCP endpoint", group: "Developer", shortcut: "mod+m", icon: Copy },
  { value: "deploy", label: "Deploy to production", group: "Developer", shortcut: "mod+d", icon: Rocket, confirm: "Deploys the current branch to production" },
];

export function CommandQuickBar({ onRun }: { onRun?: (value: string) => void }) {
  return (
    <Command
      onValueChange={(value) => {
        if (value) onRun?.(value);
      }}
      className="mx-auto w-full max-w-lg overflow-hidden rounded-2xl border border-border bg-card shadow-2xl"
    >
      <div className="flex items-center gap-2.5 border-b border-border px-4 py-3">
        <Search className="h-4 w-4 text-sky-400" aria-hidden="true" />
        <CommandInput
          aria-label="Search commands"
          placeholder="Type a command or search actions..."
          className="w-full bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"
        />
      </div>

      <CommandList className="max-h-72 overflow-y-auto p-2">
        <CommandEmpty className="py-8 text-center text-xs text-muted-foreground">
          No matching commands.
        </CommandEmpty>

        {(["Workspace", "Developer"] as const).map((group) => (
          <CommandGroup key={group} className="mb-2 last:mb-0">
            <CommandGroupLabel className="px-2.5 py-1.5 text-[11px] font-bold uppercase tracking-wider text-muted-foreground">
              {group}
            </CommandGroupLabel>
            {COMMANDS.filter((item) => item.group === group).map((item) => {
              const Icon = item.icon;
              return (
                <CommandItem
                  key={item.value}
                  value={item.value}
                  shortcut={item.shortcut}
                  data-agent-confirm={item.confirm}
                  className="flex cursor-pointer items-center justify-between rounded-xl px-3 py-2 text-sm text-foreground transition data-highlighted:bg-sky-400/15 data-highlighted:text-sky-200"
                >
                  <span className="flex items-center gap-2.5">
                    <CommandItemIcon>
                      <Icon className="h-4 w-4 text-sky-400" aria-hidden="true" />
                    </CommandItemIcon>
                    <span className="font-medium">{item.label}</span>
                  </span>
                  <CommandShortcut
                    className="rounded-md border border-border bg-background/80 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground"
                  />
                </CommandItem>
              );
            })}
          </CommandGroup>
        ))}
      </CommandList>
    </Command>
  );
}

export default CommandQuickBar;