react-country-flag vs react-world-flags vs react-flags-select vs react-flag-kit
Country flag display and country selection in React
react-country-flagreact-world-flagsreact-flags-selectreact-flag-kitSimilar Packages:

Country flag display and country selection in React

Choose a display representation and asset-loading model, then decide whether the application needs a full selection control. Rendering one flag and managing a selected country are separate jobs.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-country-flag1,064,431-22.9 kB-4 years agoMIT
react-world-flags121,20617310.8 MB163 years agoMIT
react-flags-select44,1182121.94 MB44a year agoMIT
react-flag-kit23,3865010.8 kB4-MIT

Display versus selection

A flag component renders a symbol for a code. A country selector additionally manages a list, labels, interaction, and a selected value. The four packages overlap in visual output but do not all provide the same input control.

PackageMain interfaceImage or symbol delivery
react-country-flagcountryCode and optional svgPlatform emoji or an SVG image URL
react-flag-kitNamed FlagIcon with code and sizeCDN-hosted SVG image
react-flags-selectselected, onSelect, labels and searchA country-selection UI with flag components
react-world-flagscode and fallbackBundled SVG data rendered as images

Choose the asset model deliberately

react-country-flag produces regional-indicator emoji by default. The platform determines how that emoji appears. Enabling svg changes the rendering to an image whose URL is built from the code; cdnUrl and cdnSuffix allow adapting that route. These are different presentation and loading models, not two guarantees of identical appearance.

react-flag-kit exposes FlagIcon and creates an image using its own CDN URL pattern. The current implementation does not bundle every FlagKit SVG into the component module. Its declared React peer range covers React 16.6 through 18, so that declaration alone does not establish React 19 support.

react-world-flags resolves its supported country-code forms to a flag and supplies the image from bundled data. It offers fallback content for an unmatched code. Bundling assets and requesting an image remotely have different delivery characteristics; choose based on the intended application build and rendering behavior rather than a generic claim that every flag package works offline in the same way.

Choose a controlled input when users must select

react-flags-select uses a required selected string and an onSelect callback that receives the chosen country code. The application updates the selected value. Options include a country subset, custom labels, and searchable choices. Replacing it with a display-only flag component means implementing that selection behavior yourself.

For a simple badge, a display component can be sufficient. For an actual country input, compare the selection and label contract as well as the visual flags. Provide the desired text labels and image attributes through the supported props; do not assume every display component supplies the same labels automatically.

Integration checks

Confirm the accepted code format, framework peer requirements, asset-loading path, and how an unknown code is handled. If changing packages, adapt countryCode versus code and the selector's controlled-value interface explicitly. Similar screenshots do not make these props or asset contracts interchangeable.

How to Choose: react-country-flag vs react-world-flags vs react-flags-select vs react-flag-kit

  • react-country-flag:

    Choose a flag component with emoji display by default and an SVG image option. The SVG route uses a configurable image URL; the emoji appearance follows the host platform.

  • react-world-flags:

    Choose image-based flag display with bundled SVG data and support for documented two-letter, three-letter, or numeric country codes. Provide fallback content for an unmatched code.

  • react-flags-select:

    Choose a controlled country-selection interface with flags, labels, and optional search. Supply selected and onSelect and update the selected value in application state.

  • react-flag-kit:

    Choose a named FlagIcon component with code and size props. Its current implementation loads SVG images from a CDN rather than embedding the complete asset collection.

README for react-country-flag

react-country-flag

React component for emoji/svg country flags.

NPM JavaScript Style Guide

Install

npm install --save react-country-flag

BREAKING CHANGES

v3.x NONE only Typescript Types were introduced, enjoy!

v2.x has breaking changes

  • code is now countryCode
  • title and aria-label are not defined any more, it is up to the developer to pass these in
  • styleProps is now style

Usage

All props are passed onto the element, everything can be overwritten.

import React from "react"
import ReactCountryFlag from "react-country-flag"

function ExampleComponent {
    return (
        <div>
            <ReactCountryFlag countryCode="US" />

            <ReactCountryFlag
                className="emojiFlag"
                countryCode="US"
                style={{
                    fontSize: '2em',
                    lineHeight: '2em',
                }}
                aria-label="United States"
            />

            <ReactCountryFlag countryCode="US" svg />

            <ReactCountryFlag
                countryCode="US"
                svg
                style={{
                    width: '2em',
                    height: '2em',
                }}
                title="US"
            />

            <ReactCountryFlag
                countryCode="US"
                svg
                cdnUrl="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/1x1/"
                cdnSuffix="svg"
                title="US"
            />
        </div>
    )
}

export default ExampleComponent

Detecting Emoji support

Try this out and conditionally render your country flag https://github.com/danalloway/detect-emoji-support

License

MIT © danalloway