{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/combobox-06","type":"registry:component","title":"Combobox 6","description":"combobox with add new option functionality","dependencies":["lucide-react"],"registryDependencies":["button","combobox","label"],"files":[{"path":"src/registry/new-york/components/combobox/combobox-06.tsx","content":"'use client'\n\nimport { useId } from 'react'\n\nimport { PlusIcon } from 'lucide-react'\n\nimport { Button } from '@/registry/new-york/ui/button'\nimport {\n  Combobox,\n  ComboboxCollection,\n  ComboboxContent,\n  ComboboxEmpty,\n  ComboboxInput,\n  ComboboxItem,\n  ComboboxList,\n  ComboboxSeparator,\n  ComboboxTrigger,\n  ComboboxValue\n} from '@/registry/new-york/ui/combobox'\nimport { Label } from '@/registry/new-york/ui/label'\n\nconst universities = [\n  {\n    value: '',\n    label: 'Select university'\n  },\n  {\n    value: 'harvard',\n    label: 'Harvard University'\n  },\n  {\n    value: 'cambridge',\n    label: 'University of Cambridge'\n  },\n  {\n    value: 'stanford',\n    label: 'Stanford University'\n  },\n  {\n    value: 'texas',\n    label: 'University of Texas'\n  }\n]\n\nconst ComboboxWithSearchAndButtonDemo = () => {\n  const id = useId()\n\n  return (\n    <div className='w-full max-w-xs space-y-2'>\n      <Label htmlFor={id}>Combobox with search and add button</Label>\n      <Combobox id={id} items={universities} defaultValue={universities[0].value}>\n        <ComboboxTrigger\n          render={\n            <Button variant='outline' className='w-full justify-between font-normal'>\n              <ComboboxValue />\n            </Button>\n          }\n        />\n        <ComboboxContent>\n          <ComboboxInput showTrigger={false} className='max-w-full' placeholder='Select university' />\n          <ComboboxEmpty>No items found.</ComboboxEmpty>\n          <ComboboxList>\n            <ComboboxCollection>\n              {item => (\n                <ComboboxItem key={item.value} value={item.value}>\n                  {item.label}\n                </ComboboxItem>\n              )}\n            </ComboboxCollection>\n            <ComboboxSeparator />\n            <Button variant='ghost' className='w-full justify-start font-normal'>\n              <PlusIcon className='-ms-2 opacity-60' aria-hidden='true' />\n              New university\n            </Button>\n          </ComboboxList>\n        </ComboboxContent>\n      </Combobox>\n    </div>\n  )\n}\n\nexport default ComboboxWithSearchAndButtonDemo\n","type":"registry:component","target":"components/shadcn-studio/combobox/combobox-06.tsx"}]}