Components
Avatar
An image element with a fallback for representing the user.
Demo
Code
JD
Installation
Usage
Basic Usage
With Fallback
Display initials when image fails to load:
Sizes
Variants
With Status Indicator
Show online/offline status:
Avatar Group
Display a group of avatars:
Compound Component Pattern
For more control, use the compound component pattern:
API Reference
Avatar (Simple)
All-in-one avatar component.
| Prop | Type | Default | Description |
|---|---|---|---|
source | ImageSourcePropType | — | Image source |
fallback | string | — | Fallback text or initials |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Avatar size |
variant | 'default' | 'primary' | 'secondary' | 'outline' | 'default' | Visual variant |
status | 'online' | 'offline' | 'away' | 'busy' | — | Status indicator |
alt | string | — | Accessibility label |
className | string | — | Additional classes |
AvatarGroup
Container for displaying multiple avatars.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Required | Avatar components |
max | number | — | Maximum avatars to show |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Size for all avatars |
variant | 'default' | 'primary' | 'secondary' | 'outline' | 'default' | Variant for all avatars |
className | string | — | Additional classes |
AvatarRoot
Container for compound pattern.
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Avatar size |
variant | 'default' | 'primary' | 'secondary' | 'outline' | 'default' | Visual variant |
className | string | — | Additional classes |
AvatarImage
Image component for compound pattern.
| Prop | Type | Default | Description |
|---|---|---|---|
source | ImageSourcePropType | Required | Image source |
alt | string | — | Accessibility label |
AvatarFallback
Fallback component for compound pattern.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Required | Fallback content |
className | string | — | Additional classes |