Skip to content Filter Chat CSS Components Web Components
Badge content
Badge
Badge displays a dynamic notification that can be placed within clickable elements such as a button a link, profiles, or avatars. It enhances the component to which it is attached with additional information like counting hidden selections and communicating success, warnings or errors.
Badges are typically positioned as overlays to other components, such as buttons, links or avatars. Don't place badge as a standalone component; always wrapping another element.
UX/UI Guidelines
Check the design documentation of the component in ZeroHeight.
Implementations
The component Badge
is available in the following technologies:
Parameters
Parameters
Parameters are the attributes that can be used to customize the component when using it in a project. They apply to the WebComponents implementation and wrappers and to the Vue and React CSS implementations. Some parameters names change between the implementations, in order to follow the conventions of each technology and framework.
For example, the param model
is named ngModel
in Angular, modelValue
in Vue, but stays as model
in React.
By default, all the parameters are optional or can be set in different, except for the ones marked as required
The parametrization of the component can be done with the following custom params or properties:
Name | Type | Slottable | Description |
---|---|---|---|
config | string | The main parameter has three components following the pattern:
| |
text if config is "text" | string | Value inside the badge. Needs to be used if the type of the badge is | |
icon if config 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 | |
content | string | ✅ | The content of the badge. |
fill | string | Changes the color of the badge. Check the colors section. | |
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
| |
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:
- Size (
select
) - Type (
select
) - Color (
select
) - Outline (
boolean
) - Label (
text
) - Icon (
instance
)
Customization
INFO
Check everything about the customization mechanics in the "How it works" documentation.
CSS Variable | Type | Description |
---|---|---|
--z-badge--bg | color | Background color |
--z-badge--color | color | Foreground color |
--z-badge--border-color | color | Border color |
The background, foreground & border color can be customized using the --z-badge--bg
, --z-badge--color
and --z-badge--border
CSS variables or the custom
attribute.