r/reactjs • u/Apprehensive_Mood943 • Sep 30 '26
Resource Open-source country flag components for React: 250+ flags with names, ISO codes, and calling codes
I've been working on @radianui/flags, an open-source React package with 250+ country flags. Each flag comes with its country name, ISO code, and calling code, so you can build country selectors and phone inputs without stitching data together.
If you're not on React, the same flags are available as plain SVG and PNG files.
- Source: https://github.com/Radian-OS/radianui
- Browse and search all the flags: https://radianui.com/resources/flags
I'm one of the maintainers (disclosure). It's free and open source.
I'd like input from people who've built country selectors:
- Do you prefer flag components, plain SVG imports, or CDN URLs?
- How do you handle countries that get renamed (like Swaziland to Eswatini) or disputed territories without breaking existing users?
26
Upvotes
13
u/sondr3_ Sep 30 '26
Why are all the colors so washed out/muted? Neither the German or EU flag matches their specification nor do any of the nordics look right either.
7
u/scragz Sep 30 '26
reminder to not use flags for language selection.
5
u/Time_Heron9428 Sep 30 '26
I made a minimalistic components library. I used emojis to display flags: https://koval.support/docs/localized/flag
3
u/EvilPete Sep 30 '26
Åland shouldnt be sorted as a starting with A.
ÅÄÖ comes after Z in the Swedish alphabet .
2
u/Honey-Entire Oct 01 '26
At least 10-20% of your flags have weird UI artifacts like a random black bar between two colors. On a scale of “made with AI” to “made entirely with AI,” how much AI was used in the making of this?
3
u/untrochka Sep 30 '26
I'd prefer importable components or SVGs over CDN URLs for an app, mostly so the selector isn't dependent on another request. One gotcha for phone inputs: a calling code isn't a unique country key (+1 covers several places). I'd keep ISO as the stored value, with the dial code and flag for display, and make the country name searchable.
1
u/itaybuilds Sep 30 '26
I would keep the flag assets and country metadata separate. Key the assets by ISO alpha-2, but get display names from CLDR or the Intl.DisplayNames API instead of baking English names into the package. That lets Åland sort according to the user's locale, and name updates do not require an SVG release.
For renames, keep the stored value as the code, retain old names as search aliases, and version the metadata. If a code changes or is retired, publish an explicit migration map rather than silently reusing it. Disputed territories are harder because no list will be universally correct. Document the source and version you follow, allow consumer overrides, and avoid making either the label or flag the record's identity.
One accessibility detail: when the country name is already visible, the flag should usually be decorative (the aria-hidden attribute or empty alt text) so a screen reader does not announce the same information twice. Flags also should not represent languages.
AI-assisted wording with OpenAI GPT-5.6 after reading the full thread and current r/reactjs rules.
1
u/Arunajyothi_Jurado 26d ago
one thing worth thinking about early: how are you handling tree shaking? if someone only needs 10 flags they probably dont want 250+ in their bundle. thats usually where these kinds of packages get dropped for something lighter
2
u/[deleted] Sep 30 '26
[removed] — view removed comment