Avatar
Installation
Usage
Changing Image src, srcset, or sizes starts a new image request. Fallback remains available while images load or fail, and returns when the loaded Image is removed. Native onload and onerror callbacks run alongside the internal state updates.
Examples
Sizes
Shapes
Image unavailable
API reference
Avatar.Root
Provides the avatar container.
| Prop | Type | Default |
|---|---|---|
size | "sm" | "md" | "lg" | "xl" | undefined | 'md' |
shape | "circle" | "square" | undefined | 'circle' |
children | Snippet<[]> | undefined | — |
class | string | undefined | — |
Avatar.Fallback
Renders fallback avatar content.
| Prop | Type | Default |
|---|---|---|
children | Snippet<[]> | undefined | — |
class | string | undefined | — |
Avatar.Image
Renders the avatar image.
| Prop | Type | Default |
|---|---|---|
src | string | undefined | — |
alt | string | undefined | '' |
class | (string & (ClassValue | null)) | undefined | — |
children | Snippet<[]> | undefined | — |
pnpm dlx @mielui/svelte add avatar