Command

A command palette in the style of Spotlight, built on cmdk.

@cupertinoui/commandRegistry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/command

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

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

<Command>
  <CommandInput placeholder="Spotlight Search" />
  <CommandList>
    <CommandGroup heading="Applications">
      <CommandItem>Calendar</CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

Examples

Dialog

⌘K opens the palette over the page, like Spotlight.

API Reference

Every part forwards the props of the underlying element. The props below are the ones CupertinoUI adds or changes.

CommandDialog

PropTypeDescription
open / onOpenChangeShows the palette in a dialog.
title / descriptionstringFor screen readers.
classNamestringExtra classes, merged with the component's own.

Command / CommandInput / CommandList / CommandGroup / CommandItem / CommandShortcut / CommandEmpty / CommandSeparator

PropTypeDescription
classNamestringExtra classes, merged with the component's own.