Skip to main content

Install the package

Peer dependencies

cmdk requires React and ReactDOM as peer dependencies. Both React 18 and React 19 (including release candidates) are supported. If your project already has React installed, no additional action is needed.

Radix UI dependencies

cmdk uses several Radix UI primitives internally. These are listed as regular dependencies and are installed automatically when you install cmdk. You do not need to install these packages separately.

Client component requirement

cmdk is a client component — it cannot be used in React Server Components. Add 'use client' to any component that imports cmdk.

Next.js App Router

In the Next.js App Router, all components are Server Components by default. Add the 'use client' directive at the top of any file that imports from cmdk.
You can keep 'use client' scoped to a single wrapper component and import that component from your Server Components freely.

Vite / Create React App

In projects where all components are client components by default (Vite, Create React App, etc.), no extra configuration is needed. Import and use cmdk directly.