Summary
Searchable country picker with circle flags. Stores a single ISO 3166-1 alpha-2 code. Offers the 249 officially assigned ISO 3166-1 entries by default, including dependent territories. Add non-ISO regions explicitly when your application needs them. Flags are local SVG assets shared with PhoneField.Basic usage
Standard country picker
Whitelist and browser detection
State & validation
Stored value
State is a single uppercase two-letter country or territory code. The default catalog accepts ISO 3166-1 codes; explicitly enabled non-ISO regions are also accepted.getState() result to a string column; a JSON cast is unnecessary for this field.
Validation rules
Built-in validation ensures the submitted code is in the resolved country list.Validation runs against the submitted value before display normalization. Labels such as
Poland, unknown codes, excluded markets, numeric values and arrays are
rejected. required() rejects an empty value. Hydration can normalize an existing
lowercase code, but the browser submits uppercase identities. These rules apply
when saving through Filament’s validated form state.
Configuration API
All methods acceptClosure unless noted.
countries() / exceptCountries()
Limit the list to specific markets:
showDialCode()
Useful for address forms where phone context is helpful:
Real-world examples
Shipping address form
ISO + Kosovo
XK is user-assigned, not an officially assigned ISO country code. The other available
extensions (AC, DG, EA, IC, TA) are also excluded by default. Adding a region
does not bypass countries() or exceptCountries(). Unknown codes remain excluded.
Applications migrating from the former 255-entry list can opt into all six regions:
showDialCode() leaves its dialing description empty.
Multi-language support
Country names followapp()->getLocale() by default (Poland / Polska) from package translation overrides, then PHP ICU regional names. English names are a final fallback when ICU is unavailable. Both the initial render and the dropdown use the same names. Pin a language per field with locale(), independently of the panel locale:
Playground
/admin/flex-fields/country-field
See Playground for setup.
Related components
Performance
Flags are installed with the package and published through the regular FLEX asset
pipeline. Use the same deployment steps described in Installation:
additional_regions with the same
list, e.g. ['additional_regions' => ['XK']]. Direct CountryField instances have
no selected country by default; the schema builder’s default configuration uses PL.
In the dropdown, rows with only a country name use the same flag size as PhoneField.
Rows with a name and a second-line code or dialing description use a slightly
larger flag, scaled for the field’s sm, md or lg size. PhoneField’s compact
flag sizing is unchanged.