pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.03k stars 258 forks source link

(Input): `defaultValue` does not render and throws warning #279

Open ryparker opened 2 days ago

ryparker commented 2 days ago

Passing a defaultValue into an uncontrolled <Command.Input /> causes a console warning and the value does not appear in the input.

warning in console:

Warning: Primitive.input contains an input of type text with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props.

Reproduced demo: https://codesandbox.io/p/sandbox/cmdk-default-value-bug-qpkpwv