Skip to content

Flag

A flag drawn at a 5:4 ratio, from the 304 flags of Tabler Flags. Requires Tabler 1.7+ and its flags plugin: load tabler-flags.css (or tabler-flags.min.css) next to tabler.css, from @tabler/core/dist/css/ or the CDN.

code is the ISO 3166 code of the country (fr, br) or of a subdivision (gb-sct), and the slug of a flag without one (european-union, nato, african-union). It is lowercased, so BR works too. The full list is on Tabler’s flags page.

size takes the avatar sizes, xxs to 2xl, so a flag and an avatar in one list line up. Without it, the flag is the size of an avatar:

A flag is a picture: label names it (role="img" and an aria-label), for a flag on its own. Without label, it is decoration, hidden with aria-hidden="true": put the country name in text next to it, as here.

A flag is not a language: on a language switcher, write the language name, in that language.

Prop Type Default Description
code string — ISO 3166 code or slug of the flag (flag-country-{code}), lowercased
size string? null xxs xs sm md lg xl 2xl (flag-{size})
label string? null Accessible name (role="img", aria-label); unset, the flag gets aria-hidden="true"

Other attributes go to the <span class="flag">.

None: a flag has no parts.

None: the flag is an empty <span>, drawn by the stylesheet.