in src/components/ui/virtualized-combobox.tsx [194:235]
export function VirtualizedCombobox({
options,
searchPlaceholder = "Search items...",
value,
onValueChange,
width = "400px",
height = "400px",
}: VirtualizedComboboxProps) {
const [open, setOpen] = React.useState(false);
const [selectedOption, setSelectedOption] = React.useState("");
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="justify-between"
style={{
width: width,
}}
>
{value}
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="p-0" style={{ width: width }}>
<VirtualizedCommand
height={height}
options={options.map((option) => ({ value: option, label: option }))}
placeholder={searchPlaceholder}
selectedOption={value}
onSelectOption={(currentValue) => {
onValueChange(currentValue);
setOpen(false);
}}
/>
</PopoverContent>
</Popover>
);
}