Command

ComboboxContext Menu

A searchable command palette, inline or as a ⌘K dialog.

Suggestions
Home⌘H
Documentation
Analytics
Settings
Settings⌘,
Security
Billing
or press ⌘J

Installation

pnpm add krz-ui

Usage

import { Command, CommandDialog } from "krz-ui";
<CommandDialog
  open={open}
  onOpenChange={setOpen}
  hotkey="k"
  groups={[
    {
      heading: "Pages",
      items: [
        { value: "home", label: "Home", onSelect: () => router.push("/") },
        { value: "settings", label: "Settings", keywords: ["preferences"], shortcut: "⌘," },
      ],
    },
  ]}
/>

API Reference

PropTypeDescription
groupsCommandGroup[]Groups with an optional heading and items.
items[].onSelect() => voidRuns when the item is chosen with click or Enter.
items[].keywordsstring[]Extra words that match the search.
placeholder / emptyTextstring / ReactNodeSearch placeholder and no-results text.
onSelect(item) => voidCalled for every selected item.
open / onOpenChangeboolean / (open) => voidCommandDialog only: controls the dialog.
hotkeystringCommandDialog only: ⌘ / Ctrl + this key toggles it.
className / style / ref—All go to the palette (for CommandDialog, the palette inside the dialog; style the dialog with classNames.dialog). See Customization.
classNames{ search?, input?, list?, empty?, group?, heading?, item?, icon?, shortcut?, dialog?, overlay? }Extra classes for inner parts. (`dialog` and `overlay` are on CommandDialog.)