Combobox - Admin Components

Note: This component is available since Medusa v2.21.0.

The Combobox component is a select input with search, multi-select, pagination, and the option to create new values. The Medusa Admin uses it in forms where the user chooses records loaded from the Medusa backend, such as a product's collection or a region's payment providers.

Code
import { Combobox } from "@medusajs/dashboard/components"

Example#

Pair Combobox with the useComboboxData hook to load the options from the Medusa backend and paginate them as the user scrolls:

Code
1import { Combobox, Form } from "@medusajs/dashboard/components"2import { useComboboxData } from "@medusajs/dashboard/hooks"3import { sdk } from "../lib/sdk"4
5const CollectionField = ({ control }) => {6  const collections = useComboboxData({7    queryKey: ["product_collections"],8    queryFn: (params) =>9      sdk.admin.productCollection.list(params),10    getOptions: (data) =>11      data.collections.map((collection) => ({12        label: collection.title,13        value: collection.id,14      })),15  })16
17  return (18    <Form.Field19      control={control}20      name="collection_id"21      render={({ field }) => (22        <Form.Item>23          <Form.Label>Collection</Form.Label>24          <Form.Control>25            <Combobox26              {...field}27              options={collections.options}28              searchValue={collections.searchValue}29              onSearchValueChange={30                collections.onSearchValueChange31              }32              fetchNextPage={collections.fetchNextPage}33              disabled={collections.disabled}34            />35          </Form.Control>36          <Form.ErrorMessage />37        </Form.Item>38      )}39    />40  )41}

To let the user select multiple values, pass an array as the value prop. The onChange function then receives an array of the selected values.


Props#

Aside from the HTML props of an input element, Combobox accepts the following props:

Loading...
Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵