# SVG version

> Use the SVG files for the web and design tools - they scale without quality loss and come in four visual styles.

Download Tabler Flags as SVG files that scale without quality loss, in four visual styles, with a JSON list of every flag.

Source: https://docs.tabler.io/flags/static-files/svg

---

## Installation

```shell
npm install @tabler/flags
yarn add @tabler/flags
pnpm install @tabler/flags
bun install @tabler/flags
```

or just [download from GitHub](https://github.com/tabler/tabler-flags).

## Usage

The package has one directory per visual style, and one SVG file per flag inside it. The file name is the flag's slug, for example `poland.svg`:

```text
node_modules/@tabler/flags/dist/
  rounded/poland.svg
  plain/poland.svg
  gradient/poland.svg
  shiny/poland.svg
  flags.json
```

- `rounded` is the default look, with rounded corners and a thin inset border - the same look as the [CSS plugin](/flags/css).
- `plain` is the bare flag on a 5:4 canvas, for when you draw your own frame.
- `gradient` and `shiny` add a soft shading on top of the flag.

Load a file as an image and set its size with CSS. Every flag has the same 5:4 ratio, so set the width or the height and the other side follows:

```html
<img src="node_modules/@tabler/flags/dist/rounded/poland.svg" alt="Poland" width="30" height="24" />
```

A flag can also be a `background-image`, which is how the CSS plugin works:

```css
.flag-poland {
  background: url('node_modules/@tabler/flags/dist/plain/poland.svg') no-repeat center / cover;
}
```

## List of flags

`flags.json` lists every flag with its name, category and ISO code, keyed by slug. Use it to build a country select or to map an ISO code to a file:

```js
import flags from '@tabler/flags/flags.json';

flags.poland; // { name: 'Poland', category: 'Countries', iso: 'PL' }
```

The full list of flags, slugs and ISO codes is in the [repository README](https://github.com/tabler/tabler-flags#flags).
