Skip to main content

Installation

Or use the CLI:

About

The Command component is built on top of cmdk by Dip.

Usage

Component API

Command

The root command menu component. Props:
  • Standard React component props
  • className - Additional CSS classes

CommandDialog

A command menu rendered inside a dialog. Props:
  • title - Dialog title (default: "Command Palette")
  • description - Dialog description
  • showCloseButton - Show close button (default: true)
  • open - Control dialog open state
  • onOpenChange - Callback when open state changes

CommandInput

The search input field. Props:
  • placeholder - Placeholder text
  • value - Controlled input value
  • onValueChange - Callback when value changes

CommandList

Container for command items with scroll overflow. Props:
  • className - Additional CSS classes

CommandEmpty

Displayed when no results are found. Props:
  • Children to display when empty

CommandGroup

Groups related commands together. Props:
  • heading - Group heading text
  • className - Additional CSS classes

CommandItem

An individual command item. Props:
  • onSelect - Callback when item is selected
  • disabled - Disable the item
  • value - Search value for filtering

CommandShortcut

Displays keyboard shortcuts. Props:
  • Children to display (typically keyboard shortcut text)

CommandSeparator

Visual separator between groups.

Examples

Dialog

Open the command menu in a dialog:

Shortcuts

Add keyboard shortcuts to command items:

With Icons

Add icons to command items:

Groups and Separators

Organize commands with groups and separators:

Accessibility

  • Full keyboard navigation support
  • ARIA labels and roles
  • Focus management
  • Screen reader compatible

API Reference

See the cmdk documentation for complete API details.