Skip to content

@vibe-labs/design-vue-avatars

Vue 3 avatar components for the Vibe Design System. Wraps @vibe-labs/design-components-avatars with full reactivity, deterministic color generation, LQIP image loading, and accessibility.

Installation

ts
import { VibeAvatar, VibeAvatarGroup } from "@vibe-labs/design-vue-avatars";

Requires the CSS layer to be loaded (either via @vibe-labs/design-components-avatars or the umbrella @vibe-labs/design-components).

Components

VibeAvatar

Renders a circular avatar with automatic initials fallback, deterministic background colors derived from the name, and optional LQIP image crossfade.

Basic Usage

vue
<!-- Initials only (color auto-generated from name) -->
<VibeAvatar name="Jane Doe" />

<!-- With image -->
<VibeAvatar name="Jane Doe" src="/avatars/jane.jpg" />

<!-- With LQIP thumbnail -->
<VibeAvatar name="Jane Doe" src="/avatars/jane-full.jpg" thumb-src="/avatars/jane-thumb.jpg" />

<!-- With status -->
<VibeAvatar name="Jane Doe" src="/avatars/jane.jpg" status="online" />

<!-- Sizes -->
<VibeAvatar name="Jane Doe" size="xs" />
<VibeAvatar name="Jane Doe" size="sm" />
<VibeAvatar name="Jane Doe" size="md" />
<VibeAvatar name="Jane Doe" size="lg" />
<VibeAvatar name="Jane Doe" size="xl" />

<!-- Custom colors -->
<VibeAvatar name="Jane Doe" bg-color="#ff6b6b" fg-color="#fff" />

<!-- Clickable (adds button role + keyboard support) -->
<VibeAvatar name="Jane Doe" clickable @click="openProfile" />

<!-- With ring -->
<VibeAvatar name="Jane Doe" ring />

<!-- Custom overlay slot -->
<VibeAvatar name="Jane Doe">
  <MyBadgeOverlay />
</VibeAvatar>

Props

PropTypeDefaultDescription
namestringrequiredFull name — used for initials and deterministic color
initialsstringautoOverride auto-generated initials (max 2 chars)
srcstringProfile image URL
thumbSrcstringLow-quality placeholder for LQIP crossfade
altstringnameImage alt text
sizeAvatarSize"md"xs · sm · md · lg · xl
statusAvatarStatusonline · offline · busy · away
bgColorstringautoOverride background color
fgColorstringautoOverride text color (auto-contrasted if bgColor set)
loadingImageLoadingStrategy"lazy"Image loading strategy
ringbooleanfalseShow outer ring
clickablebooleanfalseEnable button role + keyboard activation

Events

EventPayloadDescription
imageLoadstring (src)Image loaded successfully
imageErrorstring | undefinedImage failed to load

Slots

SlotDescription
defaultCustom overlays, badges, or decorations

How It Works

  1. Initials are extracted from name (first letter of each word, max 2) and displayed immediately
  2. Deterministic colors are generated from name via ColorFromString — same name always produces the same color
  3. If src is provided, VibeImage handles loading with optional LQIP crossfade from thumbSrc
  4. Once the image loads, it covers the initials layer
  5. If the image fails, initials remain visible as fallback

VibeAvatarGroup

Horizontal stack of avatars with overlap and optional "+N" overflow indicator.

Usage

vue
<VibeAvatarGroup :max="3" label="Team members">
  <VibeAvatar name="Alice" src="/a.jpg" />
  <VibeAvatar name="Bob" src="/b.jpg" />
  <VibeAvatar name="Charlie" src="/c.jpg" />
  <VibeAvatar name="Diana" src="/d.jpg" />
  <VibeAvatar name="Eve" src="/e.jpg" />
</VibeAvatarGroup>
<!-- Renders: [Alice] [Bob] [Charlie] +2 -->

Props

PropTypeDefaultDescription
maxnumberMaximum visible avatars before overflow badge
labelstringAccessible group label (aria-label)

Utilities

getInitials(name, max?)

Extract initials from a name string.

ts
import { getInitials } from "@vibe-labs/design-vue-avatars";

getInitials("John Doe"); // "JD"
getInitials("Alice"); // "A"
getInitials("Jean-Luc Picard"); // "JP"
getInitials("A B C D", 3); // "ABC"

Dependencies

PackagePurpose
@vibe-labs/coreColorFromString deterministic color generation
@vibe-labs/design-components-avatarsCSS tokens + generated styles
@vibe-labs/design-vue-imagesVibeImage component for LQIP loading

Build

bash
npm run build

Built with Vite + vite-plugin-dts. Outputs ES module with TypeScript declarations.