Avatar
Displays a user avatar with image, generated fallback, and optional status indicator.
Default
The default avatar shows the generated fallback state that most pages will rely on before image data is available.
J
tsx
<Avatar name="John Doe" />Installation
tsx
import { Avatar } from "madagent";Sizes
X
S
M
L
X
tsx
<div style={{ display: "flex", gap: 12, alignItems: "center", flexWrap: "wrap" }}>
<Avatar name="XS" size="xs" />
<Avatar name="SM" size="sm" />
<Avatar name="MD" size="md" />
<Avatar name="LG" size="lg" />
<Avatar name="XL" size="xl" />
</div>With Status
O
O
B
A
tsx
<div style={{ display: "flex", gap: 12, alignItems: "center", flexWrap: "wrap" }}>
<Avatar name="Online" status="online" />
<Avatar name="Offline" status="offline" />
<Avatar name="Busy" status="busy" />
<Avatar name="Away" status="away" />
</div>With Image
tsx
<Avatar src="https://i.pravatar.cc/80?u=demo" alt="Demo user" />API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | - | Image URL for the avatar |
alt | string | "" | Alt text for the avatar image |
name | string | - | Name used for the fallback avatar generation |
size | "xs""sm""md""lg""xl" | "md" | Avatar size |
status | "online""offline""busy""away" | - | Status indicator dot |
RTL Support
Components automatically adapt to right-to-left languages using CSS logical properties.
Preview
ع
Usage
tsx
<div style={{ display: "flex", justifyContent: "center" }}>
<Avatar name="علي" size="lg" />
</div>