Skip to content
Porcelana

Avatar

Profile image with an initials fallback, and overlapping groups.

Data & displayRadix primitive ↗

Example

Example.tsx
import { Avatar, AvatarGroup } from "@porcelana/ui";

export default function Example() {
  return (
    <AvatarGroup aria-label="Shared with">
      <Avatar name="Pierre Jochem" color="#f6c519" style={{ color: "#3a2d00" }} />
      <Avatar name="Ana Maria" color="#b8066f" />
      <Avatar name="Lena Kraus" color="#1d7a64" />
    </AvatarGroup>
  );
}

Import

Import
import { Avatar } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Avatar

PropTypeDefaultDescription
namerequiredstring–Person's name: used for alt text and to derive initials.
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
colorstring–Background color of the initials fallback.
idstring–Element id. Generated automatically when omitted.
sizenumber44Diameter in px.
srcstring–Image URL. Initials show while it loads or if it fails.

Accessibility

  • The image's alt text and the fallback's label both use name.
  • AvatarGroup is a group; give it an aria-label.