Avatar

An image element with a fallback for representing the user.

Sarah Miller
James Chen
AR
TK
LW
Dev Patel
DP

Installation

CLI

Install the component using the StarUI CLI:

star add avatar

Examples

Sizes

Override the default size-10 using Tailwind size utilities on the Avatar container

XS
SM
MD
LG
XL
2X

Image Error Fallback

AvatarFallback content appears when the image URL is broken or omitted

James Chen
JC

Valid URL

Dev Patel
DP

Broken URL

AR

No image

Status & Badges

Overlay status dots and notification counts using absolute positioning with accessible labels

SM
JC
AR
Sarah Miller
SM
3

Avatar Group

Stack avatars with negative spacing and ring borders via the data-slot selector

James Chen
JC
Sarah Miller
SM
AR
TK
+3

User Profiles

Avatar paired with name and metadata in common layout patterns

James Chen
JC

James Chen

[email protected]

AR

Ava Rodriguez

Engineering Lead

TK

Tom Kim

Last active 2 hours ago

API Reference

Props

Prop Type Default Description
cls str '' Additional CSS classes. Use Tailwind size utilities (size-6 through size-20) to override the default size-10
Component Description
Avatar Root container. Renders as a rounded-full overflow-hidden flex container with data-slot='avatar' for parent-context selectors
AvatarImage Image element with built-in error detection via Datastar signals. Props: src (str, required), alt (str), loading (str, default 'lazy'), signal (str | Signal) for external error state control
AvatarFallback Displayed when no AvatarImage is provided or the image fails to load. Accepts any children — typically 1-2 character initials