Avatar
A sticker-style avatar with a white die-cut ring and a candy edge. When there is
no image, the fallback takes the avatar's flavour. Give it an emote and a
manga emotion mark pops off it when the pointer arrives.
MC
YUMIRE+3
Installation
❯ npx shadcn@latest add https://yan.moe/r/avatar.jsonUsage
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"<Avatar variant="mint">
<AvatarImage src="/mochi-avatar.svg" alt="Mochi-chan" />
<AvatarFallback>MC</AvatarFallback>
</Avatar>Wrap several in AvatarGroup to overlap them into a row; the one under the pointer hops up.
Accessibility
- Built on Radix Avatar: the fallback shows while the image loads and stays if it fails.
- Give
AvatarImagea meaningfulalt, or an empty one when the name is already next to it. - Fallback initials are plain text, so they are read out. Keep them short.
API
| Prop | Type | Default |
|---|---|---|
variantFlavour of the edge and the fallback. | "sakura" | "lavender" | "mint" | "sky" | "lemon" | "peach" | "sakura" |
sizeDiameter: 32, 44 or 64 px. | "sm" | "default" | "lg" | "default" |
emoteA mark such as ♪, ♡ or ! that pops off the avatar on hover. | string | - |
delayMsSet on AvatarFallback. Wait before showing it, to avoid a flash on fast connections. | number | - |