Avatar
Metrics & Status

Avatar

User or entity avatar. Shows initials when no image is provided, otherwise the image. Supports three sizes and custom background colors.

Props

Avatar extends HTMLAttributes<HTMLDivElement>.

AvatarProps props
PropTypeDefaultDescription
initialsstring—Fallback initials shown when no src is given.
srcstring—Image URL. When provided, renders an <img> instead of initials.
altstring""Alt text for the image.
size"sm" | "md" | "lg""md"Avatar size.
colorstring—Background color override (any CSS color).

Examples

Sizes

JD
JD
JD
Avatar sizes

With initials

AL
MK
TS
RH
Avatar initials

With image src

Avatar with src

With custom colors

AB
CD
EF
GH
Avatar colors
ImportTSX
import { Avatar } from "@solarius/onset";
import type { AvatarProps } from "@solarius/onset";