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 prop (only when withGravatar is enabled)name, email, or custom initials textPassing an email derives the avatar's initials and label. To also look up a Gravatar
image for that address, opt in with withGravatar. Gravatar is off by default — only
enable it where surfacing a third-party image for an email is appropriate (e.g. your own
team members), not for your customers' own contacts.
If 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.
Use the size prop to pick from the same four tiers as Coin (sm, md, lg, xl), defaulting to md. The initials text scales with the size to stay balanced inside the avatar.
The initials typography is derived from size, but you can fine-tune it with the text-prefixed props: text (a typography style), textSize, textWeight, textFamily, and textFontStyle. Passing textSize (or a full text style) overrides the size-balanced default.
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 foreground (initials + currentColor) of the avatar. Only applies
when autoColor is off; otherwise the auto-generated variant wins.
The email address of the user. Used to derive initials and a label, and —
when withGravatar is true and no src is provided — to look up a
Gravatar image.
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 size of the avatar, matching Coin's size tiers.
The initials text scales with the size to stay balanced inside the coin
— override that with textSize (or a full text style).
The source URL of the image. Takes precedence over email-based Gravatar images.
Status indicator color for the avatar.
A predefined typography style for the initials. When set, it replaces the
size-balanced font size (override the font size again with textSize).
The font family of the initials.
The font style of the initials.
The font size of the initials. Overrides the size balanced against size
(or implied by text).
The font weight of the initials.
Whether to look up a Gravatar image from email when no src is provided.
Defaults to false — set to true to opt in to the Gravatar lookup.
Otherwise the avatar falls back to initials.
Whether to show a tooltip with the label.