From the contributor
How to use this sample
Summary
This sample demonstrates displaying the flag of the country selected in the single selection SharePoint choice column.

The country flag is shown using the FlagCDN - CDN & API of flags web site API. So, allow flagcdn.com domain in HTML Field Security settings of your SharePoint site by following this Microsoft official documentation: Allow or restrict the ability to embed content on SharePoint pages.
You can find the list of countries used in this JSON sample at: Countries
Add list of countries in the choice column settings like:

View requirements
- This format can be applied to any text based column but a single selection choice column is the intent
Sample
| Solution | Author(s) |
|---|---|
| text-country-flag.json | Ganesh Sanap |
Version history
| Version | Date | Comments |
|---|---|---|
| 1.0 | August 28, 2023 | Initial release |
| 1.1 | October 19, 2025 | Renamed from choice-country-flag to text-country-flag |
Disclaimer
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.