CountrySelect - Admin Components

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

The CountrySelect component is a Combobox pre-populated with countries, where the value of a country is its lowercased ISO 2 code. The Medusa Admin uses it in address and shipping forms.

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

Example#

Use CountrySelect as the control of a Form field, as shown in the Forms guide:

Code
import {
  CountrySelect,
  Form,
} from "@medusajs/dashboard/components"

const CountryField = ({ control }) => {
  return (
    <Form.Field
      control={control}
      name="country_code"
      render={({ field }) => (
        <Form.Item>
          <Form.Label>Country</Form.Label>
          <Form.Control>
            <CountrySelect
              autoComplete="country_code"
              {...field}
            />
          </Form.Control>
          <Form.ErrorMessage />
        </Form.Item>
      )}
    />
  )
}

The field's value is the country's ISO 2 code in lowercase, such as us, which is the format that the Medusa backend expects.


Props#

CountrySelect accepts the same props as Combobox, except for options, since it populates the countries itself. It also 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
⇧↵