Skip to main content
Flags live on their own subpath so the artwork for 265 countries never lands in a bundle that does not ask for it — see Subpath exports.

Props

CountryFlag

A country’s flag, drawn as a circle. Use it wherever a row is keyed by country — a demographics breakdown, a country picker, the country selector on PhoneField. Prefer this to a flag emoji: emoji flags fall back to bare letter pairs on Windows, where the fonts carry no flag glyphs.
string
required
Two-letter country code, case-insensitive (e.g. "US", "nl"). Codes we hold no artwork for render a grey placeholder disc, so a live feed of country codes can be passed straight through.
string
Accessible name, e.g. the country’s translated name. Leave unset when the flag sits next to that name anyway — it is then hidden from assistive tech rather than read out twice.
16 | 24 | 32 | 20
default:"20"
Rendered edge length in px. Defaults to 20, the size the designs use.

Exported types

Also exported from @fanvue/ui/flags: CountryFlagCode, CountryFlagProps, CountryFlagSize.

Examples

Default

Unknown country code

Sizes

Every flag

Supported codes

Codes are case-insensitive, mostly ISO 3166-1 alpha-2 plus the extras the artwork source ships (eu, un, xk). Anything with no artwork renders the grey placeholder disc, so a live feed of country codes can be passed straight through without filtering.
Setup: Installation · Theming · Subpath exports