# cmdk — card for AI agents

Command menu component library for React applications.

Category: UI components and icons · npm package `cmdk` · latest version 1.1.1 (checked 2026-11-01)
Install: `npm install cmdk`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## cmdk
- Give every `Command.Item` a `key` and a unique `value`. If `value` is omitted it is inferred from `.textContent`, and values are always trimmed.
- Treat cmdk as a client component that requires React 18. Do not use it in a React server component.
- Add your own `keydown` listener for ⌘K/Ctrl+K and toggle `open` on `Command.Dialog`. cmdk does not listen for the shortcut.
- Keep `open` on `Command.Dialog` `false` during server rendering to avoid hydration mismatches.
- For lists beyond 2,000-3,000 items, pass `shouldFilter={false}`, filter yourself and add your own virtualization.
- Style through the `[cmdk-*]` data attributes. Groups are hidden with the `hidden` attribute, not unmounted.
- Use `useCommandState` only for advanced cases such as a detailed empty state. Conditionally render `Command.Loading` while async items load.

## What it is
- cmdk (written ⌘K in its README) is a React component for command menus. The README says it "can also be used as an accessible combobox." The repository describes it as a "Fast, unstyled command menu React component". It is MIT licensed and the GitHub repository was created on 2022-07-15.
- You build the menu from parts: `Command`, `Command.Input`, `Command.List`, `Command.Group`, `Command.Item`, `Command.Empty`, `Command.Separator` and `Command.Loading`. You render items and cmdk filters and ranks them against the search text. `Command.Dialog` wraps the menu in Radix UI's Dialog. The package ships no styles. Each part carries a `cmdk-` data attribute that you target with your own CSS.
- The README says Paco wrote the first version in 2019 to see if a composable combobox API was possible. It was rewritten in 2022. The latest release, v1.1.1 (2025-03-14), fixes key bindings firing twice during IME composition. It is for React projects that need a search-and-run menu or a combobox and want full control over styling.

## Caveats
- No virtualization: The FAQ says cmdk does not virtualize. It reports good performance up to 2,000-3,000 items. For more, pass `shouldFilter={false}` and bring your own virtualization.
- You wire up ⌘K yourself: The component does not listen for the keyboard shortcut. The README's dialog example adds its own `keydown` listener to toggle `open`.
- React 18 is required: cmdk depends on React 18 hooks. The FAQ also says it is a client component, not a React server component.
- Concurrent mode is unproven: Asked whether it is concurrent mode safe, the maintainers answer "Maybe". They note it uses manual DOM ordering.
- Hydration depends on the dialog's server state: The FAQ says a hydration mismatch is likely a bug in your code. `Command.Dialog` must render closed on the server.

## Numbers (AgentGid data)
- Gid Score: 80.1 (#101 of all tools, 8 of 230 in its category)
- Used in 393 public projects set up for AI coding agents (6.3%)
- Downloads last week: 50,963,592 (as of 2026-11-24), +14.9% over 4 weeks
- GitHub stars: 13,189 (as of 2026-11-24)
- Last push: 2025-10-29

## Often used with
Class Variance Authority 98.7%, Lucide React 98.5%, clsx 97.2%, Tailwind Merge 96.9%, Radix UI 89.3%, Sonner 83.5%

## Links
- AgentGid page: https://agentgid.com/tools/cmdk/
- Homepage: https://github.com/pacocoursey/cmdk#readme
- Repository: https://github.com/pacocoursey/cmdk
- Source: https://github.com/pacocoursey/cmdk#readme
- Source: https://github.com/pacocoursey/cmdk
- Source: https://github.com/pacocoursey/cmdk/releases

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
