Vue Country Flag Component

2.3.2 · active · verified Tue Apr 21

vue-country-flag-next is a dedicated Vue 3 component designed for displaying country flags, primarily identified by ISO 3166-1 alpha-2 or alpha-3 codes. The current stable version is 2.3.2, with an active release cadence addressing bug fixes and minor improvements. A key differentiator is its optimized footprint, achieved in v2.1.0 by loading flag images as separate files rather than base64 encoded strings within the CSS, reducing the package size by approximately 700kb. It natively supports TypeScript and integrates seamlessly into Vue 3 projects, offering optional properties for size, rounded borders, and shadows.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates installation via npm, global registration of the `CountryFlag` component in a Vue 3 application, and basic usage within a template with various `country`, `size`, `rounded`, and `shadow` props.

npm install vue-country-flag-next

// main.js or similar entry file
import { createApp } from 'vue';
import App from './App.vue';
import CountryFlag from 'vue-country-flag-next';

const app = createApp(App);

// Register globally for easy use across your application
app.component('country-flag', CountryFlag);

app.mount('#app');

// In a Vue component's template (e.g., App.vue):
// <template>
//   <div>
//     <country-flag country='it' size='big'/>
//     <country-flag country='hr' size='normal'/>
//     <country-flag country='fr' size='small'/>
//     <country-flag country='rus'/>
//     <country-flag country='de' rounded/>
//     <country-flag country='jp' shadow/>
//   </div>
// </template>

view raw JSON →