nxt-flags

Angular component to show country flags.

Usage no npm install needed!

<script type="module">
  import nxtFlags from 'https://cdn.skypack.dev/nxt-flags';
</script>

README

nxt-flags

GitHub license npm scope

Angular component to show country flags.

Demo

Docs

Install

Install the package with NPM:

$ npm install nxt-flags

Import the module to app.module.ts:

import { FlagsModule } from 'nxt-flags';

@NgModule({
    ...
    imports: [
        ...,
        FlagsModule,
        ...
    ],
    ...
})

Add this lines to angular.json:

{
    ...
    "assets": [
        ...,
        {
            "glob": "**/*",
            "input": "./node_modules/nxt-flags/assets/flags",
            "output": "./assets/flags"
        }
    ].
    ...
}

Usage

Use the tag nxt-flag with attribute country="xx" (where xx is the ISO 3166-1-alpha-2 code of a country):

<nxt-flag country="br"></nxt-flag>

Optional attributes

attribute options default description
size 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 48 sets the flag width
format 'none', 'round', 'square' 'none' sets the flag format