Architecture and Composition
cmdk exposes a composable sub-component API consisting of Command.Input, Command.List, Command.Item, Command.Group, Command.Empty, and related elements. It automatically ranks and displays items based on text content or an explicit value. Developers can customise sorting by passing a ranking callback with filter, registering search aliases via keywords, or bypassing automatic evaluation altogether with shouldFilter={false}.
Customisation and Behaviour
The component ships without styles, delegating visuals entirely to the host application. HTML outputs include targeted data attributes such as cmdk-root, cmdk-item, and selection state flags (data-selected). The list height can be animated cleanly through the exposed CSS variable --cmdk-list-height.
Modals and Advanced UX
For elevated palette overlays, Command.Dialog incorporates Radix UI Dialog primitives, enabling keyboard hotkeys (such as ⌘K/Ctrl+K) and configurable portal containers. Advanced flows like multi-step nested navigation pages, deferred sub-items, and asynchronous data fetching are demonstrated as standard composition patterns.