Veil UI
Components

Command Palette

Alias of Command Menu for global search-driven actions.

Installation

$ npx veil-ui@latest add command-palette

Usage

import { CommandPalette } from "@/components/ui/command-palette";

<CommandPalette
  trigger={<button type="button">Command palette</button>}
  items={[{ label: "Settings" }]}
/>;

Examples

Basic

Grouped

API reference

CommandPalette re-exports CommandMenu. Use it when the trigger is a global shortcut rather than a page control.

Accessibility

  • Inherits the dialog title, combobox search field and option semantics from Command Menu.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add command-palette --framework vue or switch the framework in components.json.

<script setup lang="ts">
import {
  CommandMenu,
  type CommandMenuItem,
} from "@/components/ui/command-menu";
import { cn } from "@/lib/utils";

const props = withDefaults(
  defineProps<{
    items: CommandMenuItem[];
    placeholder?: string;
    emptyMessage?: string;
    title?: string;
    class?: string;
  }>(),
  {
    placeholder: "Search commands…",
    emptyMessage: "No results found.",
    title: "Command menu",
  },
);

const open = defineModel<boolean>("open", { default: false });
</script>

<template>
  <CommandMenu
    v-model:open="open"
    :items="props.items"
    :placeholder="props.placeholder"
    :empty-message="props.emptyMessage"
    :title="props.title"
    :class="cn(props.class)"
  >
    <template v-if="$slots.trigger" #trigger>
      <slot name="trigger" />
    </template>
  </CommandMenu>
</template>

On this page