react-world-flags

SVG flags of the world for react.

Installation

npm install react-world-flags

Usage

import Flag from 'react-world-flags'

<Flag code={ code } />

Where code is the two letter, three letter or three digit country code.

You can also pass an optional fallback which renders if the given country code you are trying to render doesn't exist:

import Flag from 'react-world-flags'

<Flag code="foo" fallback={ <span>Unknown</span> }/>

All props but code and fallback are passed through to the rendered img

<Flag code="nor" height="16" />

// <img src="data:image/svg+xml..." height="16">

GitHub