CountrySelect
Searchable country picker built on Combobox and wired to react-hook-form via useField. Stores the ISO 3166-1 alpha-2 code (e.g. 'US') in form state and renders a flag emoji next to each country name. The list opens with US, Canada, Australia, and the United Kingdom at the top.
Usage
Must be used inside a Form (or any react-hook-form provider). Drop it inside a Form.Field to get the label, description, and error wiring for free.
Clearable
Pass showClear to show an inline × button that resets the field to an empty string. Useful for optional country filters where “any country” is a valid selection.
Restricted list
Pass countries to limit the dropdown to a custom set — e.g. the destinations a carrier supports. The shape is { code, name }.
Props
| Name | Type | Description |
|---|---|---|
name | string | Field name. Inherited from Form.Field context if omitted. |
placeholder | string | Placeholder text. Defaults to 'Select country'. |
disabled | boolean | Disable the input. |
showClear | boolean | Show an inline Ă— button to reset the value. Defaults to false. |
noAutofill | boolean | Block browser/password-manager autofill. Saved-address fillers commonly target country fields and conflict with the combobox — opt in to suppress. Defaults to false. |
countries | Country[] | Override the country list. Defaults to the full list with US/CA/AU/GB at the top. |
onChange | (code: string) => void | Fires after the selected code changes. |
onBlur | FocusEventHandler<HTMLInputElement> | Blur handler. |
Notes
- Filtering is locale-aware via Base UI’s built-in
Comboboxfilter — typing matches against the rendered label (flag + name). - Flag emojis are computed from the country code via regional indicator codepoints, so no extra dependency is required.
- Pair with
Form.StreetAddressto gate US-only address lookup on the selected country (see StreetAddress → “Conditional lookup”).