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>.
| Prop | Type | Default | Description |
|---|---|---|---|
initials | string | — | Fallback initials shown when no src is given. |
src | string | — | Image URL. When provided, renders an <img> instead of initials. |
alt | string | "" | Alt text for the image. |
size | "sm" | "md" | "lg" | "md" | Avatar size. |
color | string | — | Background color override (any CSS color). |
Examples
Sizes
JD
JD
JD
With initials
AL
MK
TS
RH
With image src
With custom colors
AB
CD
EF
GH
import { Avatar } from "@solarius/onset";
import type { AvatarProps } from "@solarius/onset";