Y2K UI

Command

A command palette and search component powered by cmdk.

command-demo.app

Installation

terminal.sh
npx y2kui add command

Usage

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

<Command className="w-72">
  <CommandInput placeholder="Type a command..." />
  <CommandList>
    <CommandEmpty>No results.</CommandEmpty>
    <CommandGroup heading="Actions">
      <CommandItem>New File <CommandShortcut>⌘N</CommandShortcut></CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

Props

PropTypeDefaultDescription
CommandInputsee cmdk—Filterable search input.
CommandEmptyReactNode—Shown when no results match.
CommandGroup{ heading?: string }—Groups items under a label.
CommandItemsee cmdk—Selectable command item.
CommandShortcutReactNode—Keyboard hint label.

On this page