Vesyl UI

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.

Optional — clear with the × button

Restricted list

Pass countries to limit the dropdown to a custom set — e.g. the destinations a carrier supports. The shape is { code, name }.

Carrier supports a limited set of destinations

Props

NameTypeDescription
namestringField name. Inherited from Form.Field context if omitted.
placeholderstringPlaceholder text. Defaults to 'Select country'.
disabledbooleanDisable the input.
showClearbooleanShow an inline Ă— button to reset the value. Defaults to false.
noAutofillbooleanBlock browser/password-manager autofill. Saved-address fillers commonly target country fields and conflict with the combobox — opt in to suppress. Defaults to false.
countriesCountry[]Override the country list. Defaults to the full list with US/CA/AU/GB at the top.
onChange(code: string) => voidFires after the selected code changes.
onBlurFocusEventHandler<HTMLInputElement>Blur handler.

Notes

  • Filtering is locale-aware via Base UI’s built-in Combobox filter — 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.StreetAddress to gate US-only address lookup on the selected country (see StreetAddress → “Conditional lookup”).