Docs menu

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.json

Usage

tsx
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
tsx
<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 AvatarImage a meaningful alt, 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

PropTypeDefault
variant

Flavour of the edge and the fallback.

"sakura" | "lavender" | "mint" | "sky" | "lemon" | "peach""sakura"
size

Diameter: 32, 44 or 64 px.

"sm" | "default" | "lg""default"
emote

A mark such as ♪, ♡ or ! that pops off the avatar on hover.

string-
delayMs

Set on AvatarFallback. Wait before showing it, to avoid a flash on fast connections.

number-