Skip to content

Instantly share code, notes, and snippets.

@gauti123456
Created January 5, 2025 21:36
Show Gist options
  • Select an option

  • Save gauti123456/3fd90d7137d5c0d91fa50473cbe30245 to your computer and use it in GitHub Desktop.

Select an option

Save gauti123456/3fd90d7137d5c0d91fa50473cbe30245 to your computer and use it in GitHub Desktop.
Vue.js 3 Tutorial to Show Country Flag Icons Using vue-country-flag Library in TypeScript
<template>
<div>
<h2>Vue Country Flag Example</h2>
<!-- Display flags with different sizes -->
<CountryFlag country="us" size="big" />
<CountryFlag country="fr" size="normal" />
<CountryFlag country="de" size="small" />
<!-- You can also use custom properties like rounded, shadow, and background -->
<CountryFlag country="in" size="big" :rounded="true" :shadow="true" />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style scoped>
/* Add some custom styling if needed */
div {
text-align: center;
margin-top: 50px;
}
</style>
import { createApp } from 'vue';
import App from './App.vue';
import CountryFlag from 'vue-country-flag-next'
const app = createApp(App)
// Registering the component globally
app.component('CountryFlag', CountryFlag)
// Mount the Vue app
app.mount('#app');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment