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
import { Combobox, Form } from "@medusajs/dashboard/components"
import { useComboboxData } from "@medusajs/dashboard/hooks"
import { sdk } from "../lib/sdk"

const CollectionField = ({ control }) => {
  const collections = useComboboxData({
    queryKey: ["product_collections"],
    queryFn: (params) =>
      sdk.admin.productCollection.list(params),
    getOptions: (data) =>
      data.collections.map((collection) => ({
        label: collection.title,
        value: collection.id,
      })),
  })

  return (
    <Form.Field
      control={control}
      name="collection_id"
      render={({ field }) => (
        <Form.Item>
          <Form.Label>Collection</Form.Label>
          <Form.Control>
            <Combobox
              {...field}
              options={collections.options}
              searchValue={collections.searchValue}
              onSearchValueChange={
                collections.onSearchValueChange
              }
              fetchNextPage={collections.fetchNextPage}
              disabled={collections.disabled}
            />
          </Form.Control>
          <Form.ErrorMessage />
        </Form.Item>
      )}
    />
  )
}

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
⇧↵