Appearance
@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
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | required | Full name — used for initials and deterministic color |
initials | string | auto | Override auto-generated initials (max 2 chars) |
src | string | — | Profile image URL |
thumbSrc | string | — | Low-quality placeholder for LQIP crossfade |
alt | string | name | Image alt text |
size | AvatarSize | "md" | xs · sm · md · lg · xl |
status | AvatarStatus | — | online · offline · busy · away |
bgColor | string | auto | Override background color |
fgColor | string | auto | Override text color (auto-contrasted if bgColor set) |
loading | ImageLoadingStrategy | "lazy" | Image loading strategy |
ring | boolean | false | Show outer ring |
clickable | boolean | false | Enable button role + keyboard activation |
Events
| Event | Payload | Description |
|---|---|---|
imageLoad | string (src) | Image loaded successfully |
imageError | string | undefined | Image failed to load |
Slots
| Slot | Description |
|---|---|
default | Custom overlays, badges, or decorations |
How It Works
- Initials are extracted from
name(first letter of each word, max 2) and displayed immediately - Deterministic colors are generated from
nameviaColorFromString— same name always produces the same color - If
srcis provided, VibeImage handles loading with optional LQIP crossfade fromthumbSrc - Once the image loads, it covers the initials layer
- 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
| Prop | Type | Default | Description |
|---|---|---|---|
max | number | — | Maximum visible avatars before overflow badge |
label | string | — | Accessible 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
| Package | Purpose |
|---|---|
@vibe-labs/core | ColorFromString deterministic color generation |
@vibe-labs/design-components-avatars | CSS tokens + generated styles |
@vibe-labs/design-vue-images | VibeImage component for LQIP loading |
Build
bash
npm run buildBuilt with Vite + vite-plugin-dts. Outputs ES module with TypeScript declarations.