Skip to content

@vibe-labs/design-components-avatars

Avatar component tokens, styles, and TypeScript types for the Vibe Design System.

Usage

css
@import "@vibe-labs/design-components-avatars";
ts
import { AvatarSizes, AvatarStatuses } from "@vibe-labs/design-components-avatars/types";
import type { AvatarSize, AvatarStatus, AvatarStyleProps } from "@vibe-labs/design-components-avatars/types";

Contents

Tokens (avatar.css)

CSS custom properties defined in @layer vibe.tokens:

Sizes

TokenValue
--avatar-size-xs1.5rem
--avatar-size-sm2rem
--avatar-size-md2.5rem
--avatar-size-lg3.5rem
--avatar-size-xl5rem

Initials Font Sizes

--avatar-font-size-xs--avatar-font-size-xl — mapped to typography scale

Appearance

TokenDefaultDescription
--avatar-font-weight--font-semiboldInitials weight
--avatar-bg--surface-elevatedFallback background
--avatar-color--text-primaryFallback text color
--avatar-border-width2pxRing / group border width
--avatar-border-color--surface-baseRing / group border color
--avatar-group-overlap-0.5remNegative margin for stacked groups

Generated Styles (avatar.g.css)

Component classes generated into @layer vibe.components using attribute-based selectors.

Elements

  • Avatar — circular container with image or initials support
  • Avatar Initials — uppercase text fallback
  • Avatar Status — positioned indicator dot (bottom-right, 25% of avatar size)
  • Avatar Group — horizontal stack with overlap and border separation
  • Avatar Overflow — "+N" count badge for groups

Variants

  • Size: xs, sm, md, lg, xl (default: md)
  • Status: online, offline, busy, away — with semantic colors (success, neutral, danger, warning)

Modifiers

  • Ring — outer ring via box-shadow

TypeScript Types (types/)

ts
AvatarSizes    // ["xs", "sm", "md", "lg", "xl"]
AvatarStatuses // ["online", "offline", "busy", "away"]

type AvatarSize
type AvatarStatus

interface AvatarStyleProps { size?: AvatarSize; ring?: boolean }
interface AvatarStatusStyleProps { status?: AvatarStatus }
interface AvatarGroupStyleProps { label?: string }

Dist Structure

FileDescription
index.cssBarrel — imports tokens + generated styles
avatar.cssToken definitions
avatar.g.cssGenerated component styles
index.js / index.d.tsTypeScript types + runtime constants

Dependencies

Requires tokens from @vibe-labs/design (surfaces, typography, colors, borders, radii).

Build

bash
npm run build