HextaUI

Command: Basic

Typing filters and ranks items as you go. Groups with no matches disappear, and the list height animates to fit what is left.

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

export function CommandBasic() {
  return (
    <Command className="w-full max-w-sm">
      <CommandInput placeholder="Type a command or search…" />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Suggestions">
          <CommandItem>Calendar</CommandItem>
          <CommandItem>Search Emoji</CommandItem>
          <CommandItem>Calculator</CommandItem>
        </CommandGroup>
        <CommandSeparator />
        <CommandGroup heading="Settings">
          <CommandItem>Profile</CommandItem>
          <CommandItem>Billing</CommandItem>
          <CommandItem>Settings</CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

This adds the example as components/examples/command/basic.tsx, together with the Command component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/command-basic.json

To add only the component, follow the Command installation.

Props in this example

The Command props this example sets, from the API reference.

PropTypeDefault
placeholder
string–
PropTypeDefault
heading
ReactNode–

Every prop is in the Command API reference.

See them all, with keyboard support and accessibility notes, on the Command page.