.d.ts declaration file. All component prop types are available for inference via React.ComponentProps utilities.
The prop type interfaces (
CommandProps, ItemProps, etc.) are not exported as named exports from the package. To type component props in your own code, use React.ComponentProps<typeof Command>, React.ComponentProps<typeof Command.Item>, etc.Import styles
cmdk supports two import styles. Both are fully typed.The namespace import (
Command) and the individual named exports (CommandRoot, CommandList, etc.) refer to the same underlying components. Use whichever style fits your project.Component prop types
CommandProps
Props for theCommand root component (also exported as CommandRoot).
CommandFilter
The type of the custom filter function accepted byCommand.
0 and 1. A score of 0 hides the item entirely; 1 is the highest possible rank. The built-in defaultFilter export uses the command-score algorithm and can be used as a reference implementation or fallback.
DialogProps
Props forCommand.Dialog, which renders the command menu inside a Radix UI Dialog. Extends all CommandProps plus the Radix DialogProps.
InputProps
Props forCommand.Input. Extends the native <input> element, with value, onChange, and type omitted in favour of the controlled API below.
ListProps
Props forCommand.List, the container that holds items and groups.
ItemProps
Props forCommand.Item.
GroupProps
Props forCommand.Group, which groups items under an optional heading.
SeparatorProps
Props forCommand.Separator. The separator is automatically hidden when a search query is active.
LoadingProps
Props forCommand.Loading, a progressbar rendered while async items are being fetched.
EmptyProps
Props forCommand.Empty, which renders automatically when no items match the current query.
State type
TheState type represents the internal state object exposed by useCommandState.
