Command.Input is the text field users type into to search the command menu. As the user types, items are filtered and sorted in real time. All standard HTML <input> props are forwarded to the underlying element, with the exception of value, onChange, and type, which are managed internally or replaced by cmdk-specific props.
[cmdk-input]
Command.Input automatically sets autoComplete="off", autoCorrect="off", spellCheck={false}, and type="text". These are not configurable.Props
string
Controlled value of the search input. When provided, the component operates in controlled mode — the input displays this value and
onValueChange is called on every keystroke. Syncs the internal search state automatically.(search: string) => void
Callback fired when the search query changes. Receives the current value of the input as a string.
React.ComponentPropsWithoutRef<'input'> are supported and forwarded to the underlying <input> element, including placeholder, className, autoFocus, disabled, ref, aria-*, and data-* attributes.
Examples
Uncontrolled
In most cases you don’t need to control the input value — cmdk manages the search state internally:Controlled search state
Usevalue and onValueChange when you need to read or reset the search query externally:
Auto-focus on open
PassautoFocus to focus the input as soon as the menu renders:
