# country-flag-icons
**Repository Path**: mirrors_catamphetamine/country-flag-icons
## Basic Information
- **Project Name**: country-flag-icons
- **Description**: Vector (*.svg) country flag icons in 3x2 aspect ratio
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-24
- **Last Updated**: 2026-04-25
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# country-flag-icons
[](https://www.npmjs.com/package/country-flag-icons)
[](https://www.npmjs.com/package/country-flag-icons)
Vector country flag icons in `3:2` aspect ratio.
* Optimized for small size on screen (little detail, minimalism).
* Small file size (generally `1 KB` per flag).
* Exports a React component for each flag (from `/react` subpackage).
[See the flags](http://catamphetamine.gitlab.io/country-flag-icons/3x2)
## Use
The `.svg` files could be found in `/3x2/` subfolder of the `npm` package.
If you're a javascript developer:
```
npm install country-flag-icons --save
cd ./node_modules/country-flag-icons/3x2
```
If you are not a javascript developer, you could [download](https://unpkg.com/country-flag-icons/3x2/flags.zip) a `.zip` archive with all flags, or [browse](https://unpkg.com/country-flag-icons/3x2/) the `/3x2/` subfolder online for individual `.svg` files.
Those're the only valid options to get the `.svg` files. Don't download the `.svg` files from any other source. For example, don't download them from the [github repository](https://github.com/catamphetamine/country-flag-icons/) or the [gitlab repository](https://gitlab.com/catamphetamine/country-flag-icons/) because the `.svg` files are not "minified" there.
After obtaining the `.svg` files, you could include them in your apps or in your design mock-ups, etc. For web usage, if you'd prefer to not go through the hassle of hosting the `.svg` files yourself, consider using the [github mirror](https://purecatamphetamine.github.io/country-flag-icons/3x2/) or the [gitlab mirror](https://catamphetamine.gitlab.io/country-flag-icons/3x2/).
## API
### `hasFlag(countryCode: string): boolean`
Tells whether there's a flag for a given [country code](#country-code).
```js
import { hasFlag } from 'country-flag-icons'
hasFlag('US') === true
hasFlag('ZZ') === false
```
### `countries: string[]`
The list of supported [country codes](#country-code).
```js
import { countries } from 'country-flag-icons'
countries.includes('US') === true
countries.includes('ZZ') === false
```
### Web
One could either manually host the `.svg` files or use the existing [github mirror](https://purecatamphetamine.github.io/country-flag-icons/3x2/) or [gitlab mirror](https://catamphetamine.gitlab.io/country-flag-icons/3x2/).
```html
```
Flags could also be used in the form of CSS classes imported from [`country-flag-icons/3x2/flags.css`](https://unpkg.com/country-flag-icons/3x2/flags.css) where all flag icons are inlined as `background-image` "data URLs" and the flag icon height could be set via `--CountryFlagIcon-height` [CSS variable](https://caniuse.com/#feat=css-variables).
What if my project doesn't use CSS variables?
####
In that case, the default flag icon height is `1em`, and to change it, just set a `font-size`:
```css
/* Set flag icon height to 24px. */
[class*=' flag:'], [class^='flag:'] {
font-size: 24px;
}
```
### React
React components for all flags are available in the `/react/3x2` subpackage.
```js
import { US } from 'country-flag-icons/react/3x2'
```
Or they could be imported individually, if your bundler doesn't support "tree shaking":
```js
import US from 'country-flag-icons/react/3x2/US'
```
### Vue
There's an [experimental component](https://gitlab.com/catamphetamine/country-flag-icons/-/issues/26) for Vue 3.
### String
The SVG code of all flags is available in the `/string/3x2` subpackage:
```js
import { US } from 'country-flag-icons/string/3x2'
console.log(US) // > '