Preview
Avatar
TypeScript
@
Installation
bash
bash
Usage
tsx
tsx
Examples
Default
Standard circular avatar with image and fallback.
Component
TypeScript
With Image
FYNo Image - Fallback
FDMutliple sizes
Mutliple sizes of avatar.
Component
TypeScript
Default
SSSS
Outline
AAAA
Features
Built-in States: Integrated
loading(shows a loader) anderror(shows alert icon) feedback.Auto-Initials: Automatically extracts initials from the
altprop if no image is found and no fallback is provided.Glassmorphism: Fallbacks and state overlays feature subtle blurs and modern backgrounds.
Responsive Sizing: Six pre-configured sizes from
xsto2xl.
Props
The Avatar component accepts the following props:
| Prop | Type | Default | Description |
|---|---|---|---|
size | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "md" | The visual size of the avatar. |
variant | "default" | "outline" | "ghost" | "glass" | "default" | Visual style of the border/container. |
state | "idle" | "loading" | "error" | "idle" | Current interaction or async state. |
src | string | - | Image source URL. |
alt | string | - | Accessible name and source for auto-initials. |
fallback | React.Node | - | Custom content for the fallback state. |
Accepts all standard props from
@radix-ui/react-avatar.