CountrySelect
Country selector with flag display.
Controlled: value (ISO 3166-1 alpha-2) drives the selection and onChange
reports the newly chosen code. A native <select> overlays the flag so the
picker keeps native keyboard and mobile behavior.
Usage
import { CountrySelect, countrySelectVariants, flagVariants } from "@desk/ui/components/country-select";Best practices
CountrySelectis the flag + native-<select>picker for a known country list; when users need type-to-filter, useCountryComboboxinstead.It is controlled-only — pass
value(ISO 3166-1 alpha-2) and anonChange; there is no uncontrolled/defaultValuemode.Give each option an alpha-2
value(e.g."US") so the overlaid flag resolves; a globe placeholder shows when the code is empty/unknown.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| aria-label | string | Accessible label for the select | |
| className | string | Additional class name | |
| disabled | boolean | Disabled state | |
| onChange | (value: T) => void | Callback when country changes | |
| options | CountryOption<T>[] | Available country options | |
| size | ResponsiveSize | null | Component size — a single token or a per-breakpoint object like
| |
| value | T | Currently selected country code |
Also exports
- const
countrySelectVariants - const
flagVariants
Composition
Used by