Skip to Content

Avatar

A circular avatar element that displays either an image, a text initials placeholder, or an icon placeholder inside a clipped round container. Exactly one of , , or / should be provided. When more than one is set the priority order is: image source → icon → initials → blank circle.

Constructor

Avatar

Creates an Avatar element.

ParameterDescription
sourceOptional image source (Texture2D or Sprite). Takes highest priority.
initialsOptional initials string (1-2 chars) shown when no image or icon is provided.
iconSourceOptional icon image source used when no is set.
iconSvgPathOptional SVG path for an icon used when no is set.
backgroundColorOptional circle background color override.
foregroundColorOptional initials/icon color override.
ringOptional border ring drawn around the circle.
sizeAvatar size step. Defaults to Medium.
keyOptional reconciliation key.

Properties

BackgroundColor

Background color of the circle. When null, theme.PrimaryColor is used for the initials variant and theme.SurfaceColor for image/icon variants.

ForegroundColor

Foreground color applied to initials text and icon tint. When null, theme.OnPrimaryColor is used for the initials variant and theme.PrimaryTextColor for the icon variant.

IconSource

A UnityEngine.Texture2D or UnityEngine.Sprite used as an icon placeholder when no Source image is provided.

IconSvgPath

An SVG resource path used as an icon placeholder when no Source image is provided.

Initials

One or two characters shown as centered text when no image or icon is provided. Typically, the user’s initials, e.g. “AB”.

Ring

Optional border drawn around the avatar circle. When null, no border is drawn.

Size

The display size of the avatar. Defaults to Medium.

Source

A UnityEngine.Texture2D or UnityEngine.Sprite to display inside the avatar circle. Takes priority over all other content.

Methods

CreateState

Last updated on