Avatar

Avatar is a visual representation of a user's profile and identity.

Figma
Sources
Figma

Anatomy

The basic elements of an avatar

  1. Background: A randomly selected fill color for the initial-based variant.
  2. Initials: The first letters of a user’s first and last names in a darker gradient of fill color.
  3. Stroke: The outer circle for the initial-based variant.
  4. Image: A user-uploaded image of themselves.

Usage Guidance

When to Use

  • Use Avatars to provide a user with a stronger identity or when an access point into their profile provides reasonable benefit.

Behaviors

Pressed States

Pressed states pertain to Avatars in standalone instances only. Avatars that are part of a larger selection item do not have individual pressed behaviors.

The pressed state of a standalone avatar

Disabled States

Disabled states apply only for non-standalone Avatars, which are a sub-component in a larger composite component such as an Avatar in a list item.

The disabled state of an avatar in a composite component

Loading States

The Avatar should not default to a generic user icon when loading. The Avatar has a skeleton that accommodates different background colors when loading.

The loading state of an avatar against different gradients

Examples

Avatars vary on the basis of version, sizing, background, and default color.

Version

Avatars default to their initial-based version unless a user manually uploads a profile photo. The lettering inside the Avatar is based on the two letter English initials of the Western equivalent of a user name.

Initial vs. image-based avatar versions

Sizing

Avatars should feel appropriately sized based on their importance and nearby content. They vary on a scale from XXS to XXL to accommodate an array of different possible use cases:

  • XXS: 24 x 24. Please note that it is recommended to use a larger size than XXS for all uses outside of pills.

XXS avatar in a pill

  • XS: 32 x 32
  • S: 40 x 40
  • M: 48 x 48
  • L: 72 x 72
  • XL: 96 x 96
  • XXL: 120 x 120

Regardless of Avatar sizing, all tap targets are 48x48 or larger.

48x48 minimum tap targets for avatar

Background

Against darker gradients, white strokes are used to increase contrast. The initial-based variant stroke becomes white and a white stroke is added around the image-based variant.

Avatar changes on white vs. darker color gradients

Color

Initial-based avatars are randomly assigned a gender neutral and contrast friendly color on a per-user basis.

Different possible colors for initial-based avatar

API Guidelines

Methods

Class name: Avatar Module name: UIComponentsPlugin

public init(
featureData: FeatureMetricsData,
context: SemanticContext = .default,
imageType: ImageType,
avatarSize: AvatarSize,
avatarColor: AvatarColor = .chiliMango,
isOnDarkBackground: Bool = false,
isEnabled: Bool = true,
isLoading: Bool = false,
onClick: @escaping (() -> Void) = {}
)

Parameters

NameDescriptionDefault values
featureDatathe feature name/context and the screen ID in which the component appears.
contextthe SemanticContext.SemanticContext.default
imageTypeType of image for the Avatar to use.
avatarSizeSize of the Avatar UI Component.
avatarColorBackground color of the Avatar UI Component.chiliMango
isOnDarkBackgroundBool indicating if the avatar is being used on a dark background.false
isEnabledBool indicating if the avatar is enabled.true
isLoadingBool indicating if the avatar should show the loading state.false
onClickClosure that represents an action associated with the avatar tap.{}

Accessibility Guidelines

Coming soon...

Can't Find What You Need?

Check out our FAQ section which may help you find the information you're looking for. For further information, contact the #canvas or #canvas-kitchannels on Slack.

FAQ Section