elementsavatar
Avatar
Circular user or entity avatar with fallback initials and an optional indicator.
Import#
Slot Structure#
Avatar renders a single image/fallback frame. Use AvatarGroup for grouped avatars with an overflow counter.
Single avatar#
Examples#
Single Avatar#
Fallback first, then image crossfades in after preload.
Sizes#
Scale single avatars from xs to xl.
Fallback Modes#
Text, initials-from-alt and fallback icon.
Badge Positions#
Top/bottom + left/right corner badge.
API Reference#
Attributes#
Slot
root0 attributesAvatar frame that controls size, shape, image, fallback, and badge placement.
No attribute metadata for this slot.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| alt | string | undefined | — | Accessible alt text for the avatar. |
| badge | IconT.Name | — | Icon name for the badge. |
| badgePosition | "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined | bottom-right | Position of the badge. |
| class | ClassValue | — | Class applied to the component root or trigger element. |
| classes | AvatarT.Classes | undefined | — | — |
| fallback | IconT.Name | — | Icon name to show as fallback. |
| onStatusChange | ((status: AvatarStatus) => void) | undefined | — | Callback when the loading status of the avatar changes. |
| ref | JSX.HTMLElementTags["span"] extends { ref?: infer Ref; } ? Ref : never | undefined | — | — |
| size | "xs" | "sm" | "md" | "lg" | "xl" | undefined | — | — |
| src | string | undefined | — | Source URL for the avatar image. |
| style | JSX.CSSProperties | undefined | — | — |
| styles | AvatarT.Styles | undefined | — | — |
| text | string | undefined | — | Initial text to show if image fails or is missing. |
| transition | "none" | "fast" | "normal" | "slow" | undefined | — | — |
Items#
| Prop | Type | Default | Description |
|---|---|---|---|
| alt | string | undefined | — | Accessible alt text for the avatar. |
| badge | IconT.Name | — | Icon name for the badge. |
| badgePosition | NonNullable<"top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined> | undefined | bottom-right | Position of the badge. |
| fallback | IconT.Name | — | Icon name to show as fallback. |
| onStatusChange | ((status: AvatarStatus) => void) | undefined | — | Callback when the loading status of the avatar changes. |
| src | string | undefined | — | Source URL for the avatar image. |
| text | string | undefined | — | Initial text to show if image fails or is missing. |