Command

A command menu allows users to search and execute commands.

Calendar
Search Emoji
Calculator
Profile⌘P
Billing⌘B
Settings⌘S
<Card className="w-full p-0">
  <Command aria-label="Command menu">
    <SearchField aria-label="Search">
      <InputGroup>
        <InputGroupAddon>
          <SearchIcon />
        </InputGroupAddon>
        <Input placeholder="Type a command or search..." />
        <InputGroupAddon className="[--addon-button-inset:--spacing(2)]">
          <Button isIconOnly variant="quiet">
            <XIcon aria-hidden="true" />
          </Button>
        </InputGroupAddon>
      </InputGroup>
    </SearchField>
    <ListBox aria-label="Commands" onAction={() => console.log("action")}>
      <ListBoxSection>
        <ListBoxSectionHeader>Suggestions</ListBoxSectionHeader>
        <ListBoxItem textValue="Calendar">
          <CalendarIcon />
          <span>Calendar</span>
        </ListBoxItem>
        <ListBoxItem textValue="Search Emoji">
          <SmileIcon />
          <span>Search Emoji</span>
        </ListBoxItem>
        <ListBoxItem textValue="Calculator">
          <CalculatorIcon />
          <span>Calculator</span>
        </ListBoxItem>
      </ListBoxSection>
      <Separator />
      <ListBoxSection>
        <ListBoxSectionHeader>Settings</ListBoxSectionHeader>
        <ListBoxItem textValue="Profile">
          <UserIcon />
          <span>Profile</span>
          <Kbd>⌘P</Kbd>
        </ListBoxItem>
        <ListBoxItem textValue="Billing">
          <CreditCardIcon />
          <span>Billing</span>
          <Kbd>⌘B</Kbd>
        </ListBoxItem>
        <ListBoxItem textValue="Settings">
          <SettingsIcon />
          <span>Settings</span>
          <Kbd>⌘S</Kbd>
        </ListBoxItem>
      </ListBoxSection>
    </ListBox>
  </Command>
</Card>

Installation

npx shadcn@latest add @dotui/command

Usage

Use command menus to provide users with a searchable list of commands or actions.

import { Command, CommandContent, CommandInput, CommandItem } from "@/components/ui/command";
<Command>
	<CommandInput placeholder="Type a command..." />
	<CommandContent>
		<CommandItem textValue="Create file">Create new file</CommandItem>
		<CommandItem textValue="Open file">Open file</CommandItem>
	</CommandContent>
</Command>

Playground

Use the controls below to experiment with different command props and see the live preview and code update.

Create new file
Create new folder
Open file
<Command className="w-[300px]">
  <SearchField placeholder="Type a command..." />
  <ListBox>
    <ListBoxSection>
      <ListBoxSectionHeader>Actions</ListBoxSectionHeader>
      <ListBoxItem textValue="Create new file">Create new file</ListBoxItem>
      <ListBoxItem textValue="Create new folder">Create new folder</ListBoxItem>
      <ListBoxItem textValue="Open file">Open file</ListBoxItem>
    </ListBoxSection>
  </ListBox>
</Command>

Examples

Calendar
Search Emoji
Calculator
Profile⌘P
Billing⌘B
Settings⌘S

API Reference

Command

Missing description.

Supports all div attributes.

CommandInput

Missing description.

PropType
string
boolean
boolean
ReactNode | function
union
DOMRenderFunction<"div", SearchFieldRenderProps>
union
string
string
function

CommandContent

Missing description.

PropType
boolean
DragAndDropHooks<NoInfer<T>>
"grid" | "stack"
Orientation
DOMRenderFunction<"div", ListBoxRenderProps>
ReactNode | function
Iterable<T>
ReactNode | function
readonly any[]
SelectionMode
SelectionBehavior
Iterable<Key> | "all"
Iterable<Key> | "all"
function
Iterable<Key>
boolean
boolean
boolean
boolean
"clearSelection" | "none"

Last updated on 5/22/2026