Command

A command palette for fast keyboard-driven navigation and action execution.

Installation

pnpm dlx stera-ui add command

Usage

import {
  Command,
  CommandInput,
  CommandList,
  CommandEmpty,
  CommandGroup,
  CommandItem,
  CommandSeparator,
  CommandShortcut,
} from "@/components/ui/command"
<Command className="rounded-lg border">
  <CommandInput placeholder="Type a command or search..." />
  <CommandList>
    <CommandEmpty>No results found.</CommandEmpty>
    <CommandGroup heading="Settings">
      <CommandItem>
        <SiUser />
        <span>Profile</span>
        <CommandShortcut>⌘P</CommandShortcut>
      </CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

Command Dialog

Use CommandDialog and CommandDialogTrigger to open the command palette in a modal overlay.

Title & Description

Use CommandItemContent, CommandItemTitle, and CommandItemDescription for richer item layouts.

API Reference

CommandItem

PropTypeDefault
disabledbooleanfalse

CommandGroup

PropTypeDescription
headingstringSection label shown above the group

Subcomponents

ComponentDescription
CommandInputSearch/filter text input
CommandListScrollable list container
CommandEmptyShown when no items match the query
CommandSeparatorHorizontal divider between groups
CommandShortcutRight-aligned keyboard shortcut label
CommandItemContentColumn container for title + description
CommandItemTitlePrimary text inside CommandItemContent
CommandItemDescriptionSecondary text inside CommandItemContent
CommandDialogModal wrapper for the command palette
CommandDialogTriggerTrigger that opens the CommandDialog