Avatar
An image and fallback primitive for representing a person or entity.
AvatarView sourceExample
The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.
import { Avatar, AvatarGroup, type AvatarItem } from "innate-ui";
import classes from "../docs.module.css";
const projectMembers: ReadonlyArray<AvatarItem> = [
{ id: "ada", name: "Ada Lovelace", status: "online" },
{ id: "grace", name: "Grace Hopper", src: "/favicon.svg", status: "away" },
{ id: "alan", name: "Alan Turing", src: "/missing-avatar.png", status: "busy" },
{ id: "katherine", name: "Katherine Johnson" },
{ id: "margaret", name: "Margaret Hamilton" },
];
export function AvatarDemo() {
return (
<div class={classes.avatarDemo}>
<div class={classes.avatarRow}>
<Avatar name="Innate mark" src="/favicon.svg" size="large" status="online" />
<Avatar name="Ada Lovelace" decoration={<span class={classes.avatarDecoration}>✓</span>} />
<Avatar name="Margaret Hamilton" src="/missing-avatar.png" size="small" />
</div>
<AvatarGroup
items={projectMembers}
label="Project members"
limit={3}
total={5}
size="medium"
/>
</div>
);
}API reference
This table is generated from Innate UI's exported TypeScript declarations and JSDoc. Native element attributes inherited by a prop type are not repeated here.
AvatarProps
| Prop | Type | Default |
|---|---|---|
namerequiredPerson or entity name used for accessible text and generated initials. | JSX.ValueOrCell<string> | — |
srcImage source. Falls back to initials when absent or when loading fails. | JSX.ValueOrCell<string | null | undefined> | — |
fallbackCustom fallback content rendered instead of generated initials. | JSX.Children | — |
sizeAvatar size. | JSX.ValueOrCell<AvatarSize> | "medium" |
statusOptional presence status shown on the avatar. | JSX.ValueOrCell<AvatarStatus | null | undefined> | — |
statusLabelAccessible label for the status indicator. Defaults to the status name. | JSX.ValueOrCell<string | null | undefined> | — |
decorationOptional decoration rendered on the avatar. | JSX.Children | — |
decorativeRemoves the avatar from the accessibility tree when purely decorative. | JSX.ValueOrCell<boolean> | false |
loadingNative image loading strategy. | JSX.ValueOrCell<AvatarImageLoading> | "lazy" |
imagePropsAdditional props forwarded to the internal image element. | AvatarImageProps | — |
imageRefReceives the internal image element. | SourceCell<HTMLImageElement | null> | — |
AvatarGroupProps
| Prop | Type | Default |
|---|---|---|
itemsrequiredAvatars rendered by the group. | JSX.ValueOrCell<ReadonlyArray<AvatarItem>> | — |
labelrequiredAccessible label describing the group. | JSX.ValueOrCell<string> | — |
sizeSize applied to every avatar in the group. | JSX.ValueOrCell<AvatarSize> | "medium" |
limitMaximum number of avatars shown before the overflow indicator. | JSX.ValueOrCell<number> | 4 |
totalTotal member count when it differs from `items.length`. | JSX.ValueOrCell<number | null | undefined> | — |
renderOverflowCustom renderer for the number of hidden members. | (count: number) => JSX.Template | — |