Skip to content

Avatar - Web Component โ€‹

Browser support โ€‹

Detected engine: ย 

  • Chromium

  • Webkit

  • Gecko

Parameters โ€‹

The Web component uses the <z-avatar> tag:

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

NameTypeDescription
configstring

Custom attribute for the article card component. Possible values are: horizontal, vertical or dropdown

namestringThe name of the user profile
dropdown-elementsobject[]The dropdown elements in case layout is dropdown
image-srcstringThe URL of the image for the profile
initialsstringThe initials of the user profile
statusstringThe status of the user profile
badgeobjectThe badge for the profile
contentstringThe content of the user profile

The available slots for the component are:

NameTagsDescription
defaultspan

TIP

Check the badge and the profile components to learn more about the component.

config โ€‹

The config attribute is used to set the orientation of the avatar. Possible values are: horizontal, vertical or dropdown.

name โ€‹

The name attribute is used to set the name for the avatar.

The dropdown configuration requires the dropdown-elements attribute to be set.

Profile attributes โ€‹

image-src โ€‹

The image-src parameter is used to define the image URL to be displayed inside the avatar.

You can also use the images from the Zurich media images. Make sure you specify correctly the name of the image you want to display.

initials โ€‹

The initials it`s used to set the initials for the avatar.

status โ€‹

The status it's used to set the status for the avatar. Possible values are: online,occupied or absent

Badge attributes โ€‹

badge โ€‹

The badge it's used to set the badge for the avatar. It requires an object with the badge configuration.

Playground โ€‹

Customization โ€‹

HTML Examples โ€‹

Imports
html
<link rel="stylesheet" href="/0.4.5/@zurich/web-components/styles.css" />
<script type="module" src="/0.4.5/@zurich/web-components/avatar.js"></script>
Code
html
<z-avatar config="m" image-src="/0.4.5/sample.png" initials="AZ" layout="horizontal"
  badge='{ "config":"text", "text":"1", "fill": "peach" }' name="User name" content="Description">
</z-avatar>

<z-avatar config="m" initials="AZ" layout="horizontal" badge='{ "config":"text", "text":"1", "fill": "peach" }'
  name="User name" content="Description">
</z-avatar>