Skip to content
LogoLogo

Avatar

Avatars provide a placeholder identity for users and visually represent contacts and accounts within ActiveCampaign. They are also often used to help visually organize comment threads in Conversations.

Loading...

Loading...

Overview

Resources

Loading...

Loading...

Loading...

Loading...

Install

yarn add @camp/avatar

Props

PropTypeDefaultDescription
appearance"userContact" | "accountBusiness"userContactUse this prop to control which icon is rendered (only works without name or image).
color"midday" | "dawn" | "violet" | "moss" | "ac-blue" | "magenta"—Sets the background from a random color to the converted property value (only works with name).
namestring—Pass in a full name to render the first and last initial within Avatar.
size"small" | "medium" | "large" | "xLarge"mediumUse this prop to specify desired Avatar size.
srcstring—Use the src prop to pass in an image url.
themedbooleantrueWhether the component should adapt to the surrounding theme context (requires a `ThemeProvider`). When `false` the avatar is pinned to the light theme.

Generated from @camp/avatar@6.13.9 source, ordered by production usage. * required. † standard HTML attribute — all native attributes are supported; only those with production usage are listed.

Upgrading to Next Gen

🔄 Package and import path: Avatar is published from the Camp Design System as @camp/avatar instead of @activecampaign/camp-components-avatar. It is a named export; there is no default export.

🔆 Themed by default: themed defaults to true, so Avatar follows the surrounding light or dark theme and needs a ThemeProvider. Pass themed={false} to pin it to the light theme on a screen that has no provider yet. Initials backgrounds switch to the darker end of each primitive palette in dark mode.

🎨 color values renamed: The color prop now takes Camp primitive token names. The old values are no longer accepted:

Previous valueNew value
bananamidday
creamsicledawn
lavenderviolet
mintmoss
oceanac-blue
strawberrymagenta

🧩 appearance prop: Use appearance="userContact" (default) or appearance="accountBusiness" to choose the fallback icon when no image or initials are shown.

🏷️ HTML attributes: Standard HTML attributes (className, id, aria-*, data-*, event handlers) are part of the public props and land on the root element: the <span> for initials and icons, or the <img> when src is set.

Previous implementation

import { Avatar } from '@activecampaign/camp-components-avatar';
 
<Avatar name="Jane Doe" size="medium" color="lavender" />;

New implementation

import { Avatar } from '@camp/avatar';
 
<Avatar name="Jane Doe" size="medium" color="violet" />;

Migration steps

  1. Update the import path: Replace @activecampaign/camp-components-avatar with { Avatar } from @camp/avatar.
  2. Provide a theme: Make sure the avatar renders inside a ThemeProvider, or pass themed={false} to keep a light-only screen working without one.
  3. Rename color values: Map any explicit color to its new name using the table above. Avatars without a color keep picking a random palette color and need no change.

Variations

Avatar displays a profile image, initials, or a fallback icon. Choose the variant based on available contact data.

Image avatar

Use when an image URL is available for a contact, user, or account. The image wins over name when both are set.

import { Avatar } from '@camp/avatar';
 
<Avatar src="https://example.com/profile.jpg" size="medium" alt="Jane Doe" />;

Initials avatar

Use when no image is set but first and last name are known. Initials use the first character of the first and last words in name (middle names are collapsed). The small size shows only the first initial.

import { Avatar } from '@camp/avatar';
 
<Avatar name="John Doe" size="medium" color="violet" />;

Icon avatar

Use when there is no image and name is missing or is a single word without a space. The icon reflects appearance: contact (userContact) or account (accountBusiness).

import { Avatar } from '@camp/avatar';
 
<Avatar appearance="userContact" size="medium" />
<Avatar appearance="accountBusiness" size="medium" />

Sizes

Avatar supports small, medium, large, and xLarge. Match size to layout density and context.

import { Avatar } from '@camp/avatar';
 
<Avatar size="small" appearance="userContact" />
<Avatar size="medium" appearance="userContact" />
<Avatar size="large" appearance="userContact" />
<Avatar size="xLarge" appearance="userContact" />
SizeTypical use
smallTight spaces such as dropdown rows for a contact or account
mediumTables, lists, and activity feeds
largeAvailable but rarely used in product layouts
xLargeTop of a contact or account details page

Background colors

For initials avatars, set color to one of the primitive palette names or omit it to use a random color from the same palette. Each color has a light-mode and a dark-mode value, so initials stay legible in both themes.

import { Avatar } from '@camp/avatar';
 
<Avatar name="John Doe" color="midday" />
<Avatar name="John Doe" color="dawn" />
<Avatar name="John Doe" color="violet" />
<Avatar name="John Doe" color="moss" />
<Avatar name="John Doe" color="ac-blue" />
<Avatar name="John Doe" color="magenta" />

Long names

Long names still resolve to two initials (first and last word in the trimmed name).

import { Avatar } from '@camp/avatar';
 
<Avatar name="John Middle Public Smith" size="small" color="midday" />
<Avatar name="John Middle Public Smith" size="medium" color="ac-blue" />
<Avatar name="John Middle Public Smith" size="large" color="violet" />

Themed

themed defaults to true. The story below renders every variant three times: with themed={true}, with themed={false}, and with the prop omitted. Switch Storybook to dark mode to see the themed={false} row stay light while the other two follow the theme.

import { Avatar } from '@camp/avatar';
 
<Avatar name="John Doe" color="moss" />
<Avatar name="John Doe" color="moss" themed={false} />

Usage

Best practices

  • Prefer a profile image when src is available.
  • Pass a full name (First Last) when showing initials so users are identifiable at a glance.
  • Use appearance="accountBusiness" for account records and userContact (default) for people.
  • Match size to the layout: small in compact UI, medium in dense lists, xLarge on detail headers.
  • Set color when initials need a consistent brand or status color; omit it when a random palette color is acceptable.
  • Leave themed at its default inside a ThemeProvider; reach for themed={false} only on screens that cannot provide one yet.

Content guidelines

✅ DO

  • Use real profile images when the product has them
  • Pass complete first and last names for initials
  • Choose account vs contact appearance to match the entity type

🚫 DON’T

  • Don't rely on initials when only a single-word name is available (icon fallback will show)
  • Don't use large unless the layout specifically calls for it
  • Don't use avatars without a clear entity association in the surrounding UI

Accessibility

Images

When using src, pass a meaningful alt string on Avatar so screen readers can identify the person or account. Without one the image is rendered with an empty alt and treated as decorative. All other HTML attributes are forwarded to the <img> as well.

Icon fallback

Fallback icons carry a translated aria-label and title (Contact or Account in English) based on appearance.

Initials

Initials avatars have no built-in accessible name. Pass aria-label with the full name (it is forwarded to the root <span>) when the surrounding UI does not already name the person or account.

Keyboard support

Avatar is presentational and does not receive focus or keyboard interaction by default. If the avatar opens a profile or menu, wrap it in an interactive element (for example a button) and label that control appropriately.

Similar components

Icon

Icon

A small graphical representation of a program or function.

Skeleton

Skeleton

Provides a placeholder preview of your content before the data gets loaded.

Loading Indicator

Loading Indicator

Provides visual feedback for processes that take a noticeable amount of time to complete.

Copyright © 2026 ActiveCampaign