Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Command

A search box over a list of commands, inline or in a dialog.

Rendered by React 19.3.1

command.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/command.json

It 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

Default

Grouped commands with a search input.

Its preview and code are at the top of the page.

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.