Plinth

Command Menu

Searchable command palette, usually behind ⌘K.

Install

npx shadcn@latest add https://plinth.dhrumilkherde.com/r/command.json

Usage

Built on cmdk inside a Plinth Dialog. Wire your own shortcut:

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

const [open, setOpen] = useState(false);

useEffect(() => {
  const down = (e: KeyboardEvent) => {
    if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
      e.preventDefault();
      setOpen((o) => !o);
    }
  };
  document.addEventListener("keydown", down);
  return () => document.removeEventListener("keydown", down);
}, []);

<CommandDialog open={open} onOpenChange={setOpen}>
  <CommandInput placeholder="Type a command or search…" />
  <CommandList>
    <CommandEmpty>No results found.</CommandEmpty>
    <CommandGroup heading="Pages">
      <CommandItem onSelect={() => go("/analytics")}>
        <BarChart3 /> Analytics
      </CommandItem>
    </CommandGroup>
  </CommandList>
</CommandDialog>

An inline (non-dialog) palette is the same markup with Command instead of CommandDialog.

Accessibility

  • cmdk provides listbox semantics, arrow-key navigation, and Enter to run the highlighted command; the dialog wrapper adds focus trapping and Escape.
  • Always render CommandEmpty so "no results" is announced, not silent.

On this page