Command

Command palette pattern. Composable input + grouped item list with fuzzy search. CommandDialog wraps it in a modal for global ⌘K menus.

Default

Inline command palette anchored to its container.

Dark previewReplay previewOpen in new tab
No results found.
Suggestions
Calendar
Search Emoji
Calculator
Settings
Profile⌘P
Billing⌘B
Settings⌘S

Usage

Import the parts you need from the component's folder.

ts
import {
  Command,
  CommandDialog,
  CommandInput,
  CommandList,
  CommandEmpty,
  CommandGroup,
  CommandItem,
  CommandSeparator,
  CommandShortcut,
} from "@/components/ui/command";

Basic

A simple command menu in a dialog.

Dark previewReplay previewOpen in new tab

Shortcuts

CommandShortcut right-aligns a keyboard hint inside each item.

Dark previewReplay previewOpen in new tab

Groups

A command menu with groups, icons and separators.

Dark previewReplay previewOpen in new tab

Scrollable

A long list scrolls inside CommandList while the input stays pinned.

Dark previewReplay previewOpen in new tab

Anatomy

Import all parts and piece them together.

vue
<script setup>
import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandSeparator,
} from "@/components/ui/command";
</script>

<template>
  <Command>
    <CommandInput />
    <CommandList>
      <CommandEmpty />
      <CommandGroup>
        <CommandItem />
        <CommandItem />
      </CommandGroup>
      <CommandSeparator />
      <CommandGroup>
        <CommandItem />
        <CommandItem />
      </CommandGroup>
    </CommandList>
  </Command>
</template>

API Reference

Command

PropTypeDefaultDescription
modelValuestring—Selected item value. Supports v-model.
filter(value, search) => numberfuzzyCustom match scorer.
EventDescription
update:modelValueFires when the highlighted/selected value changes.

CommandDialog

PropTypeDefaultDescription
openboolean—Dialog open state. Supports v-model:open. Wrap the contents in a Command.
titlestring"Command Palette"Accessible dialog title (visually hidden).
descriptionstring"Search for a command to run..."Accessible dialog description (visually hidden).
showCloseButtonbooleanfalseShow the dialog close (×) button.
EventDescription
update:openFires when the dialog opens or closes.

CommandInput

PropTypeDefaultDescription
modelValuestring—Search query. Supports v-model.
placeholderstring—Placeholder text for the search field.

CommandItem

PropTypeDefaultDescription
valuestring—Value used for filtering and selection.
disabledbooleanfalseBlock selection of this item.
EventDescription
selectFires when the item is chosen via click or Enter.

CommandGroup / CommandEmpty

PropTypeDefaultDescription
headingstring—(CommandGroup) Section heading. CommandEmpty renders when no item matches.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
ATyping in the input filters the item list.
↑Moves the highlight to the previous item.
↓Moves the highlight to the next item.
EnterSelects the highlighted item.
EscCloses the palette when shown in a dialog.
  • Follows the combobox/listbox pattern: a textbox input controls a role=listbox of items.
  • aria-activedescendant tracks the highlighted item while DOM focus stays on the input.