UIComponentsReact
A search box over a list of commands, inline or in a dialog.
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/command.jsonIt also adds utils, dialog, input-group. The app needs its setup first: Installation.
Usage
Pass the items, or groups of items ({ value, items }), to Command. Render them with a function child of CommandList: a CommandItem per item, or a CommandGroup with a heading and its group.items. CommandEmpty shows when nothing matches. CommandDialog puts the whole thing in a Dialog. Filtering and the keyboard come from the headless Autocomplete, with its list inline.
import {
Command,
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandShortcut,
CommandSeparator,
} from '@/components/ui/command'Examples
Differences from shadcn's: the props follow Base UI's Autocomplete, not cmdk. The items go to Command as items and are rendered by CommandList's function child; static CommandItem children are not filtered, as cmdk filters them. onSelect on an item is onClick; value is the item itself, and filter (or mode) replaces cmdk's filter and shouldFilter. The highlighted item has data-highlighted where cmdk sets data-selected, and a disabled one data-disabled. CommandEmpty sits beside CommandList, not inside it. CommandSeparator is a list separator (role="presentation").
API reference
Command wraps no headless component of its own: its parts are elements with classes, and their props are the element's.