Avatar
A compound avatar component built on Base UI primitives, supporting image display with fallback text, an optional badge indicator, and grouped avatar stacks.
Default
With imageSR
Fallback initialsJD
With badgePC
Group
UAUBUC
+5
Fallback
When the image fails to load, the fallback content is shown.
ARMJT
Group
Small (sm)
U1U2U3
Default + overflow count
ALBOCA
+7
Large (lg)
DAELFI
+2
Fallbacks only
RKSTUV
+12
Sizes
SMsm
MDdefault
LGlg
JDsm
JDdefault
JDlg
User List
- JLJordan LeeAdmin
- MKMorgan KimEditor
- RPRiley PatelViewer
- CBCasey BrownEditor
- ASAvery SinghViewer
With Badge
Use AvatarBadge to overlay a status indicator at the bottom-right corner.
ABsm
CDdefault
EFlg
ONonline
AWaway
OFoffline
Installation
npx shadcn@latest add @byronwade/avatarProps
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "default" | "sm" | "lg" | "default" | Controls the overall size of the avatar (sm=24px, default=32px, lg=40px). |
| className | string | — | Additional CSS classes merged onto the root element. |