Skip to content

Flag

UX/UI Guidelines

Check the design documentation of the component in ZeroHeight.

Implementations

The component Flag is available in the following technologies:

CSS Components
cssreactvue
Web Components
webreactvueangular

Parameters

Parameters

Make sure you have read about the parameters in here.

The parametrization of the component can be done with the following custom params or properties:

NameTypeSlotDescription
countrystring

Country code based on ISO 3166-1 alpha-2 standard.

Have a look to the available values in here

customobject

A record of key-value pairs to set the CSS custom tokens. It's a complex attribute set as an JS object in stringified JSON format.

Example:

html
<z-flag custom='{"fill":"#06e7a3"}' />

Check the available values in the customization section.

custom-strstring

The stringified version of the custom property. It follows the pattern key:value;key:value;, with the possibility of setting multiple values and spaces between the punctuation characters.

Example:

html
<z-flag custom-str="fill:#06e7a3" />
z-themestring

Sets the theme of the component. The possible values are light and dark.

html
<z-flag z-theme="dark" />

From Figma to code

You can check the Figma implementation here. The available properties are:

...

Customization

The size of the flag component can be customized by using the --z-flag--size custom property.

Extending flags or modifying sources

We can use the --z-flag--urlCSS variable to change the source of the icon. This way, we can use any SVG file as an icon. The rest of the component will behave the same.

The custom-str won't work with this prop, so we need to use the CSS or using style or custom for instances.

It's better and more comfortable to do this override anyway in a CSS general file:

css
[country="GI"] {
  --z-flag--url: url(https://upload.wikimedia.org/wikipedia/commons/9/9a/Flag_of_Spain.svg);
}

We can also use this approach to extend the icon catalog with custom icons.

css
[country="gondor"] {
  --z-flag--url: url(https://upload.wikimedia.org/wikipedia/commons/3/31/Flag_of_the_Kings_of_Gondor.svg);
}