Closed joshgalvan closed 2 months ago
Wrapping CommandItem
in a div
fixes this without affecting cmdk's functionality it seems, assuming the value you're passing to value
exists elsewhere, like in an array, which it should anyways.
<Command>
...
<CommandGroup>
{data.map((item) => (
<div key={item} onClick={() => console.log(item)}>
<CommandItem value={item}>
{item}
</CommandItem>
</div>
))}
</CommandGroup>
</Command>
You should upgrade to the latest version of cmdk, in which the value is no longer lowercased.
The
value
passed toCommand.Item
should not be changed when given back toonSelect
. If the user wants to lowercase the value they will do it.For example (via Shadcn/ui):
This will print
hello
to the console, which is not expected. The value should always be the same value that is passed to the component.