react-world-flags
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/react-world-flags package

1.6.0 • Public • Published

CircleCI

react-world-flags

Easy to use SVG flags of the world for react

Demo

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 code doesn't correspond to a flag:

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">

Caveat

The bundle contains all flags of the world and is about 1.3 MB gzipped.

SVG's are inlined using Data_URIs.

Package Sidebar

Install

npm i react-world-flags

Weekly Downloads

26,632

Version

1.6.0

License

MIT

Unpacked Size

10.8 MB

Total Files

281

Last publish

Collaborators

  • smucode