{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "multiple-selector-with-async-search",
  "title": "Multiple Selector With Async Search",
  "description": "component for the Multiple Selector With Async Search",
  "registryDependencies": [
    "@spectrumui/multiple-selector-dependencies",
    "@spectrumui/inline-code"
  ],
  "files": [
    {
      "path": "app/registry/multiple-selector/usage/multiple-selector-with-async-search.tsx",
      "content": "\"use client\";\nimport React from \"react\";\nimport MultipleSelector, {\n  Option,\n} from \"@/app/registry/spectrumui/multiple-selector-dependencies\";\nimport { InlineCode } from \"@/app/registry/spectrumui/inline-code\";\n\nconst OPTIONS: Option[] = [\n  { label: \"nextjs\", value: \"Nextjs\" },\n  { label: \"React\", value: \"react\" },\n  { label: \"Remix\", value: \"remix\" },\n  { label: \"Vite\", value: \"vite\" },\n  { label: \"Nuxt\", value: \"nuxt\" },\n  { label: \"Vue\", value: \"vue\" },\n  { label: \"Svelte\", value: \"svelte\" },\n  { label: \"Angular\", value: \"angular\" },\n  { label: \"Ember\", value: \"ember\" },\n  { label: \"Gatsby\", value: \"gatsby\" },\n  { label: \"Astro\", value: \"astro\" },\n];\n\nconst mockSearch = async (value: string): Promise<Option[]> => {\n  return new Promise((resolve) => {\n    setTimeout(() => {\n      const res = OPTIONS.filter((option) => option.value.includes(value));\n      resolve(res);\n    }, 1000);\n  });\n};\n\nconst MultipleSelectorWithAsyncSearch = () => {\n  const [isTriggered, setIsTriggered] = React.useState(false);\n\n  return (\n    <div className=\"flex w-full flex-col gap-5 px-10\">\n      <p>\n        Is request been triggered?{\" \"}\n        <InlineCode>{String(isTriggered)}</InlineCode>\n      </p>\n      <MultipleSelector\n        onSearch={async (value) => {\n          setIsTriggered(true);\n          const res = await mockSearch(value);\n          setIsTriggered(false);\n          return res;\n        }}\n        placeholder=\"trying to search 'a' to get more options...\"\n        loadingIndicator={\n          <p className=\"py-2 text-center text-lg leading-10 text-muted-foreground\">\n            loading...\n          </p>\n        }\n        emptyIndicator={\n          <p className=\"w-full text-center text-lg leading-10 text-muted-foreground\">\n            no results found.\n          </p>\n        }\n      />\n    </div>\n  );\n};\n\nexport default MultipleSelectorWithAsyncSearch;\n",
      "type": "registry:component",
      "target": "components/spectrumui/multiple-selector-with-async-search.tsx"
    }
  ],
  "type": "registry:component"
}
