On this page

Avatar

Install, props and the parts Avatar is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/avatar.json

Use

<script setup lang="ts">
import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
</script>

<template>
  <Avatar>
    <AvatarImage src="/people/linh-tran.jpg" alt="Linh Tran" />
    <AvatarFallback>LT</AvatarFallback>
    <AvatarBadge status="success">Online</AvatarBadge>
  </Avatar>
</template>

Props

Part Prop Values Notes
Avatar size sm, default, lg 24, 32 and 40 px (avatar.size.*)
AvatarImage src, alt string alt="" when the name is already next to the avatar
AvatarFallback delayMs number Waits before showing the initials, so a fast photo does not flash them
AvatarBadge status neutral (default), success, warning, danger, info Beehexa addition. The slot holds the status in words; it is visually hidden
AvatarGroup — — Overlaps the avatars inside it. Add role="group" and an aria-label
AvatarGroupCount — — The “+3” at the end of a group; takes the size of the avatars in it

Built on

Wraps the reka-ui Avatar (AvatarRoot, AvatarImage, AvatarFallback), which loads the image and shows the fallback until it loads or when it fails. The parts and props are control-center’s. Beehexa adds the styles and the status prop on AvatarBadge, whose slot is now read by screen readers instead of drawn inside the dot.