humanonlyweb/ui

Avatar

A user image with an initials fallback.

Markdown

Examples

Image and fallback

ALGHATL
Copy code

API

PropTypeDefault
name*

Accessible name, and the source of the initials fallback.

string—
src

Image URL. Falls back to initials if it's missing or fails to load.

string—
size

Size hook, exposed as data-avatar-size.

"small" | "medium" | "large""medium"
SlotProps
fallback

Shown without an image. Defaults to the initials.

{ initials: string; }

Styling

Parts
avataravatar-image
States
data-avatar-size

Accessibility

  • Screen readers hear name.
  • The initials show until the image loads, and stay if it fails.