Badge
Browser support
...
Parameters
The CSS component uses any container tag, but we recommend the use of <div>
or <span>
HTML tags with the z-badge
HTML custom attribute.
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
z-badge | string | The main parameter has three components following the pattern:
|
text | string* | Value inside the badge. Needs to be used if the type of the badge is |
icon | string* | Sets icon of the badge. Needs to be used if the type of the badge is This icon needs to be always the Attention! Make sure that you use the |
fill | string? | Changes the color of the badge. Check the colors section. |
TIP
Check a nice example of the component in vanilla HTML. Open the inspector or visualize the source code to fully understand how to use the component and/or play with it.
Playground
Customization
HTML Examples
Imports
html
<link rel="stylesheet" href="/0.3.6/@zurich/design-tokens/Icons.css" />
<link rel="stylesheet" href="/0.3.6/@zurich/css-components/base.css" />
<link rel="stylesheet" href="/0.3.6/@zurich/css-components/Badge.css" />
Code
html
<!-- For the example it's used the Medium size, make sure you try different sizes.
To change the color of the badge make sure to use the fill attribute with any of the possible values. -->
<div z-badge="text" text="+99"><span>Content</span></div>
<div z-badge="icon" icon="arrow-long-left:outline" ><span>Content</span></div>
<div z-badge="dot"><span>Content</span></div>
<!-- Outline version -->
<div z-badge="text:outline" text="+99"><span>Content</span></div>
<div z-badge="icon:outline" icon="arrow-long-left:outline" ><span>Content</span></div>
<div z-badge="dot:outline"><span>Content</span></div>