GitHub55X

Avatar

Vue avatar component for user profile images with fallback initials or placeholders when media fails.

PreviousNext

Installation

Install from the Vuzeno registry:

      
      bunx --bun shadcn-vue@latest add https://vuzeno.com/r/avatar.json
    

Usage

      
      <script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";
</script>

<template>
  <Avatar.Root>
    <Avatar.Image src="https://github.com/fontanaen.png" alt="CN" />
    <Avatar.Fallback>CN</Avatar.Fallback>
  </Avatar.Root>
</template>
    

Composition

      
      Avatar.Group
└── Avatar.Root
    ├── Avatar.Fallback
    └── Avatar.Image

Avatar.Root
├── Avatar.Context
├── Avatar.Fallback
├── Avatar.Image
├── Avatar.RootProvider
    

Examples

Sizes

Use the size prop on Avatar.Root to change the size of the avatar.

Group

Stack multiple avatars using Avatar.Group. Apply negative spacing and ring utilities on each Avatar.Root to create an overlapping effect.

API

See Ark UI Avatar docs for full props and examples.

Avatar.Root

PropTypeDefaultDescription
size"sm" | "default" | "lg""default"Size of the avatar
classstringAdditional CSS classes

Avatar.Group

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Layout direction of the group
classstringAdditional CSS classes