Avatar
Avatar with sizes and variants
View MarkdownOverview
Avatars represent a user or entity with a profile image and initials fallback.
Usage
Import the component:
import { Avatar, AvatarImage, AvatarFallback } from "@eqtylab/equality";
Basic usage with an image and fallback:
<Avatar>
<AvatarImage src="/path/to/image.jpg" alt="User name" />
<AvatarFallback>AB</AvatarFallback>
</Avatar>
Variants
Image
When a valid src is provided to AvatarImage, the avatar displays the image.
Fallback
When no image is provided or the image fails to load, AvatarFallback is displayed instead, typically showing initials.
Sizes
The size prop controls the dimensions of the avatar.
<Avatar size="sm">...</Avatar>
<Avatar size="md">...</Avatar>
<Avatar size="lg">...</Avatar>
<Avatar size="xl">...</Avatar>
Shape
The shape prop controls the border radius of the avatar.
Circle (Default)
Square
<Avatar shape="circle">...</Avatar>
<Avatar shape="square">...</Avatar>
Slots
| Name | Description |
|---|---|
children | Accepts AvatarImage and AvatarFallback as children |
Props
Avatar
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
size | The size of the avatar | sm, md, lg, xl | md | ❌ |
shape | The shape of the avatar | circle, square | circle | ❌ |
AvatarImage
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
src | The image source URL | string | - | ❌ |
alt | Accessible alt text for image | string | - | ❌ |
AvatarFallback
No properties, but needs child content to render.