Skip to main content

Command

Fast, composable, unstyled command menu for React.

import {
Command,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
} from "@/components/ui/command"

<Command className="rounded-lg border shadow-sm">
<CommandInput placeholder="Search categories" />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Section Title">
<CommandItem className="flex items-center justify-between">
<span>Item</span>
<div className="flex flex-col items-end">
<span className="font-medium">$0.01</span>
<span className="text-xs text-green-600">24.9%</span>
</div>
</CommandItem>
</CommandGroup>
</CommandList>
</Command>

API Reference​

PropTypeDefaultDescription
labelstring—Accessible label for the command menu
shouldFilterbooleantrueWhether to automatically filter items based on search
filterfunction—Custom filter function (value, search) => number
valuestring—Controlled selected value
onValueChangefunction—Callback when the selected value changes

CommandInput​

PropTypeDefaultDescription
placeholderstring—Placeholder text for the search input
valuestring—Controlled input value
onValueChangefunction—Callback when the input value changes

CommandGroup​

PropTypeDefaultDescription
headingstring—Group heading displayed above the items
forceMountbooleanfalseForce render even when no results match

CommandItem​

PropTypeDefaultDescription
valuestring—Unique value for filtering and selection
onSelectfunction—Callback when the item is selected
disabledbooleanfalseWhether the item is disabled

Accessibility​

The Command component follows WAI-ARIA combobox and listbox patterns:

  • Uses appropriate ARIA roles (combobox, listbox, option)
  • Supports keyboard navigation (Arrow keys to move between items, Enter to select)
  • Search input is properly labeled and announces results to screen readers
  • Groups use role="group" with accessible headings
  • Disabled items are properly communicated to assistive technology