Closed MentalGear closed 8 months ago
IDs don't matter. The value
prop should be unique for each item. See README's FAQ section.
Mh, using the value prop, value={String(Math.random())}
will make cmd not render any values.
That's what is being filtered by. What the user is searching by should be passed as the value.
I was finally able to get this working with value and setting off the filter (seems strange to have it on by default). Leaving it here for reference for others. Also, maybe converting the value into a string internally would be good, as passing a number for the value will cmdk throw an error.
<Command.Root shouldFilter={false}>
<Command.Input
name="nameToSearch"
placeholder="Search ..."
/>
<Command.List>
{#each result as data (data?.id)}
<Command.Item
value={String(data?.id)}
>
Thanks for this lib! Here's a small issue: Items with the same name are highlighted as being the same even though they have been given different ids.
https://github.com/huntabyte/cmdk-sv/assets/2837147/a9b529a1-909c-4971-8354-99d3663af7ce