Avatar
A user avatar that settles from a blur as the image loads, falls back to initials, shows a presence badge, and fans out in groups.
Customize
Installation
npx shadcn@latest add @kinetic/avatarUsage
Render an AvatarImage with an AvatarFallback for when the image is missing or slow.
import { Avatar, AvatarFallback, AvatarImage } from "@/components/kinetic/ui/avatar";
export function UserAvatar() {
return (
<Avatar>
<AvatarImage src="/avatars/linh.png" alt="Linh Tran" />
<AvatarFallback>LT</AvatarFallback>
</Avatar>
);
}Sizes
Use size with sm (24 px), default (32 px) or lg (40 px).
<Avatar size="lg">...</Avatar>Badge
Add AvatarBadge for presence. pulse adds a soft ring around it. Give it an aria-label.
<Avatar>
<AvatarFallback>LT</AvatarFallback>
<AvatarBadge pulse aria-label="Online" />
</Avatar>Group
Stack avatars in AvatarGroup and end with AvatarGroupCount. With spread (on by default) the stack fans apart on hover.
<AvatarGroup>
<Avatar>
<AvatarFallback>AN</AvatarFallback>
</Avatar>
<Avatar>
<AvatarFallback>MK</AvatarFallback>
</Avatar>
<AvatarGroupCount>+4</AvatarGroupCount>
</AvatarGroup>Fallback delay
Set delayMs on AvatarFallback so fast images never flash the initials. onLoadingStatusChange on the image reports loading progress.
<AvatarFallback delayMs={150}>LT</AvatarFallback>Motion preferences
Use blurPx and speed to tune the image settle and the fallback crossfade. Reduced motion shows the image and badge without animation.
API Reference
Avatar
Zero-dependency circular avatar frame providing shared blur, speed, and image loading context.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "default" | "lg" | "default" | Selects 24px (sm), 32px (default), or 40px (lg) square dimensions. |
blurPx | number | 4 | Initial blur radius in pixels cleared as AvatarImage finishes loading (clamped 0-16). |
speed | number | 1 | Animation speed multiplier shared by image settle, fallback crossfade, and badge pop-in (clamped 0.25-4). |
AvatarImage / AvatarFallback
WAAPI blur-scale image reveal and delayed fallback initials with smooth crossfade exit.
| Prop | Type | Default | Description |
|---|---|---|---|
src / alt (AvatarImage) | string | alt="" | Image source URL and descriptive alternative text defaulting to an empty string. |
onLoadingStatusChange (AvatarImage) | (status: AvatarLoadingStatus) => void | - | Notifies listeners when loading transitions across idle, loading, loaded, or error. |
delayMs (AvatarFallback) | number | 0 | Delay in milliseconds before rendering fallback initials. |
AvatarBadge / AvatarGroup / AvatarGroupCount
Pop-in corner status dot with optional WAAPI pulse ring, Euler spring hover-spread stack, and overflow counter.
| Prop | Type | Default | Description |
|---|---|---|---|
pulse (AvatarBadge) | boolean | false | Adds a continuous WAAPI pulse ring around the corner badge, honoring reduced motion and tempo. |
spread (AvatarGroup) | boolean | true | Fans stacked avatars apart via sub-stepped Euler springs on fine-pointer hover and gently lifts the hovered item. |
speed (AvatarGroup) | number | 1 | Spring speed multiplier for AvatarGroup hover spread and lift (clamped 0.25-4). |