UI Components
Avatar
User avatar with image support, initials fallback, multiple sizes, and AvatarGroup for overlapping stacks
Quick Preview
XSSMMDLGXL
Installation
// Copy the Avatar component fromsrc/components/ui/Avatar.tsx
Usage
import { Avatar, AvatarGroup } from '@/components/ui/Avatar'// With initials fallback<Avatar initials="JD" size="md" />// With image<Avatarsrc="https://example.com/photo.jpg"alt="Jane Doe"size="lg"/>// Grouped avatars<AvatarGroupavatars={[{ initials: "A" },{ initials: "B" },{ initials: "C" },{ initials: "D" },]}max={3}/>
Examples
With Image (broken image shows initials)
With image
BK
Initials fallback
AvatarGroup โ Overlapping Stack
ABCD+1
In Context โ User Row
JD
Jane Doe
jane@example.com
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | - | Image URL |
alt | string | - | Alt text for the image |
initials | string | - | Fallback text when no image (max 2 chars) |
size | "xs" | "sm" | "md" | "lg" | "xl" | "md" | Avatar size |
className | string | - | Additional CSS classes |
Features
- โ5 sizes: xs, sm, md, lg, xl
- โImage with broken-image fallback
- โInitials fallback with primary color
- โAvatarGroup with overlap + overflow counter
- โServer Component