Toggle Sidebar B
header.lightDarkMode D

Command

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

Anatomy

Import all parts and piece them together.

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

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

Default

Inline command palette anchored to its container.

No results found.
Suggestions
Calendar
Search emoji
Settings
Profile ⌘P
Settings ⌘S

Dialog (⌘K)

Open as a global modal triggered by a keyboard shortcut.

Multiple groups

Several CommandGroups divided by CommandSeparator for clearer sections.

No results found.
Files
New file
Open file
Edit
Copy
Paste
View
Zoom in
Zoom out

API Reference

Props, events, and slots for each sub-component.

Command

Props

PropTypeDefaultDescription
modelValuestringSelected item value. Supports v-model.
filter(value, search) => numberfuzzyCustom match scorer.

Events

EventDescription
update:modelValueFires when the highlighted/selected value changes.

CommandDialog

Props

PropTypeDefaultDescription
openbooleanDialog open state. Supports v-model:open.

Events

EventDescription
update:openFires when the dialog opens or closes.

CommandInput

Props

PropTypeDefaultDescription
modelValuestringSearch query. Supports v-model.
placeholderstringPlaceholder text for the search field.

CommandItem

Props

PropTypeDefaultDescription
valuestringValue used for filtering and selection.
disabledbooleanfalseBlock selection of this item.

Events

EventDescription
selectFires when the item is chosen via click or Enter.

CommandGroup / CommandEmpty

Props

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

Accessibility

Keyboard shortcuts and ARIA behavior.

Keyboard

ShortcutDescription
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.
EscClears the search, or closes 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.