A component that displays a user's avatar, supporting images, Gravatar, and initials.
The component can be imported via:
The Avatar component can display user avatars in several ways, following a priority order:
src propemail propname, email, or custom initials textIf you place the avatar without any context around it, it is recommended to add a tooltip so that the user can understand which user the avatar represents.
Use the autoColor prop to automatically generate a deterministic background and text color based on the user's name. This is useful for distinguishing users in lists when no image is available.
You should almost never need to customize the src, label, and initials. However, we do provide escape hatches for these cases.
The Avatar component follows accessibility best practices:
label, name, or emailPlumaAvatar extends BoxWhen true, automatically generates a deterministic background and text color based on the user's name or email. Useful for distinguishing users in lists when no image is available.
The email address of the user. If no src is provided, a gravatar will be used.
An icon to render instead of an image or initials.
The size of the icon. Only applies when icon is provided.
Initials to use if no image is provided. Max 2 characters.
The label for the avatar. Used for the tooltip and alt text.
The name of the user. Used to generate initials if no src is provided.
The source URL of the image. Takes precedence over email-based Gravatar images.
Status indicator color for the avatar.
Whether to show a tooltip with the label.