Skip to content CSS Components Web Components
Flag
UX/UI Guidelines
Check the design documentation of the component in ZeroHeight.
Implementations
The component Flag
is available in the following technologies:
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:
Name | Type | Slot | Description |
---|---|---|---|
country | string | Country code based on ISO 3166-1 alpha-2 standard. Have a look to the available values in here | |
custom | object | 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
Check the available values in the customization section. | |
custom-str | string | The stringified version of the Example: html
| |
z-theme | string | Sets the theme of the component. The possible values are html
|
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--url
CSS 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);
}