Skip to main content

FlagImage API

FlagImage is component for rendering country flag. It's used in CountrySelector and CountrySelectorDropdown components.

Usage Example​

Import component

import { FlagImage } from 'react-international-phone';

Use by providing the dialCode and prefix properties.

<FlagImage iso2="ua" size="30px" />

Output:

Properties​

iso2 *​

iso2 code of country flag

  • Type: string

src​

Custom src of flag

  • Type: string
  • Default: undefined

protocol​

Protocol to use with twemoji cnd

  • Type: "http" | "https"
  • Default: "https"

disableLazyLoading​

Disable lazy loading of flags (loading="lazy" attribute will not be set)

  • Type: boolean
  • Default: "https"

Style properties​

PropTypeDescription
sizeCSSProperties['width']Size of flag (set width and height)
styleCSSPropertiesCustom styles prop
classNamestringCustom className prop

CSS variables​

VariableDefault value
--react-international-phone-flag-width24px
--react-international-phone-flag-height24px