{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/combobox-11","type":"registry:component","title":"Combobox 11","description":"Multiple-select combobox with expandable badge view to show or hide selected items dynamically","registryDependencies":["combobox","label"],"files":[{"path":"src/registry/new-york/components/combobox/combobox-11.tsx","content":"'use client'\n\nimport { useId, useState } from 'react'\n\nimport {\n  Combobox,\n  ComboboxChip,\n  ComboboxChips,\n  ComboboxChipsInput,\n  ComboboxContent,\n  ComboboxEmpty,\n  ComboboxItem,\n  ComboboxList,\n  ComboboxValue,\n  useComboboxAnchor\n} from '@/registry/new-york/ui/combobox'\nimport { Label } from '@/registry/new-york/ui/label'\n\nconst frameworks = ['Next.js', 'SvelteKit', 'Nuxt.js', 'Remix', 'Astro', 'React', 'Vue', 'Angular', 'SolidJS', 'Qwik']\n\nconst MAX_VISIBLE = 2\n\nconst ComboboxMultipleExpandableDemo = () => {\n  const id = useId()\n  const anchor = useComboboxAnchor()\n  const [expanded, setExpanded] = useState(false)\n\n  return (\n    <div className='w-full max-w-xs space-y-2'>\n      <Label htmlFor={id}>Multiple combobox expandable</Label>\n\n      <Combobox\n        multiple\n        autoHighlight\n        id={id}\n        items={frameworks}\n        defaultValue={[frameworks[0], frameworks[1], frameworks[2], frameworks[3], frameworks[4]]}\n      >\n        <ComboboxChips ref={anchor}>\n          <ComboboxValue>\n            {(values: string[]) => {\n              const visibleValues = expanded ? values : values.slice(0, MAX_VISIBLE)\n              const hiddenCount = values.length - MAX_VISIBLE\n\n              return (\n                <>\n                  {visibleValues.map((value: string) => (\n                    <ComboboxChip key={value}>{value}</ComboboxChip>\n                  ))}\n                  {values.length > MAX_VISIBLE && (\n                    <ComboboxChip\n                      key='toggle'\n                      showRemove={false}\n                      className='cursor-pointer'\n                      onClick={(e: React.MouseEvent) => {\n                        e.stopPropagation()\n                        setExpanded(prev => !prev)\n                      }}\n                    >\n                      {expanded ? 'Show Less' : `+${hiddenCount} more`}\n                    </ComboboxChip>\n                  )}\n                  <ComboboxChipsInput />\n                </>\n              )\n            }}\n          </ComboboxValue>\n        </ComboboxChips>\n        <ComboboxContent anchor={anchor}>\n          <ComboboxEmpty>No items found.</ComboboxEmpty>\n          <ComboboxList>\n            {(item: string) => (\n              <ComboboxItem key={item} value={item}>\n                {item}\n              </ComboboxItem>\n            )}\n          </ComboboxList>\n        </ComboboxContent>\n      </Combobox>\n    </div>\n  )\n}\n\nexport default ComboboxMultipleExpandableDemo\n","type":"registry:component","target":"components/shadcn-studio/combobox/combobox-11.tsx"}]}