Avatars
Represent a user or entity with an image, initials, or icon across a range of sizes and shapes, and combine several into a stacked group.
Avatar Sizes
XS
SM
MD
LG
XL
2XL
Avatar with Status
JD
AB
CD
EF
Avatar Group
A
B
C
D
+5
Usage
<script setup lang="ts">
import { VdAvatar } from "@vanduo-oss/vd3";
</script>
<template>
<VdAvatar initials="AL" />
<VdAvatar src="/ada.jpg" alt="Ada Lovelace" size="lg" status="online" />
<VdAvatar initials="JS" variant="success" shape="rounded" />
<VdAvatar initials="AB" variant="danger" shape="square" size="xl" />
</template>API Reference
CSS Classes
| Class Name | Description | Type |
|---|---|---|
.vd-avatar | Base component class required for all VD3 UI avatars. | Component |
.vd-avatar-[size] | Size modifier class (e.g., -xs, -sm, -lg, -xl, -2xl). Defaults to medium if omitted. | Modifier |
.vd-avatar-status-[status] | Adds a status indicator badge (e.g., -online, -offline, -busy, -away). | Modifier |
.vd-avatar-group | Wrapper class for grouping multiple avatars together with overlapping margins. | Layout |
Component API (Vue 3)
| Prop | Description |
|---|---|
:src / :alt | Image source and alt text. |
:initials | Fallback initials shown when there is no image. |
:size | xs | sm | md | lg | xl | 2xl (default md). |
:variant | Initials background colour: primary | secondary | success | warning | error | danger | info (default primary). |
:shape | circle | rounded | square (default circle). |
:status | online | offline | away | busy — renders a presence dot. |
Accessibility
- Always pass a descriptive
:altwhen using:srcso screen readers announce the person or entity represented by the image. - When rendering initials without an image,
VdAvatarexposesrole="img"and uses:alt(falling back to:initials) as itsaria-label. - Presence status dots (
online,offline,busy,away) are visual indicators; convey critical availability state in adjacent text or an accessible label.