HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Avatar

A non-interactive circle that represents an entity — with an image, initials, or an icon.

Usage

forge-avatar represents an entity through imageUrl, text (rendered as initials via letterCount), or a slotted icon when neither is set. Use it for people, accounts, or records that are genuinely identifiable by image or initials, most often in a list, table row, card, or navigation header. Skip it when the image or initials add no real information, like using a category’s first letter as a stand-in avatar.

Rules

Do
Use a real photo when one is likely to be available and the person is likely to be recognizable.Fall back to initials when no image is available, rather than leaving the avatar empty.Use a larger avatar in a card or profile header, and a smaller one in a list or table row.
Don't
Don't use an avatar when the image or initials don't add information — an icon or plain text may fit better.Don't rely on an avatar's initials alone to distinguish records with the same first letter — pair it with a visible name.Don't imply interactivity — avatars have no hover or focus state of their own.

Basic usage

Set text for an avatar that renders initials — by default, the first letter of each word, controlled by letterCount.

An avatar rendering initials from its text.

With an icon

Slot a forge-icon instead of setting text or imageUrl when the avatar represents something other than a named person — like a generic account or object type.

An icon slotted in place of text or an image.

With an image

Set imageUrl to show a photo instead of initials or an icon.

An avatar showing a photo instead of initials.

Avatars represent an entity via text or image. Use avatars to visually represent users, objects, or identifiers in your application.

import "@tylertech/forge/avatar";
Properties
PropertyAttributeTypeDefaultDescription
texttextstring''The text to display in the avatar.
letterCountletter-countnumber2Controls the number of letters to display from the text. By default the text is split on spaces and the first character of each word is used.
imageUrlimage-urlstring''The background image URL to use.
Slots
NameDescription
(default)The default slot for avatar content if not provided via text/imageUrl.
CSS Parts
NameDescription
::part(root)The root container element.
::part(empty-image)The empty image container element.
CSS Custom Properties
NameDescription
--forge-avatar-backgroundThe background color of the avatar.
--forge-avatar-shapeThe border radius of the avatar, defaults to 50%.
--forge-avatar-colorThe text color of the avatar.
--forge-avatar-sizeThe height and width of the avatar.
--forge-avatar-transition-durationThe transition duration for animations.
--forge-avatar-transition-timingThe transition timing function for animations.
--forge-theme-surface-container-lowThe background color of the empty image.
--forge-theme-surface-container-highThe foreground color of the empty image.

Screen reader visibility

An avatar isn’t inherently meaningful to assistive technology. Add aria-hidden="true" when one is purely decorative, and avoid relying on an avatar for essential navigation.

Composing with an icon button

When an avatar is nested inside an icon button — a profile trigger, for example — give the icon button its own accessible label. The avatar’s image or initials aren’t announced as a label on their own.

Color and contrast

If an avatar’s color conveys meaning, such as a status ring, pair it with another visual cue for users with color vision deficiencies. Foreground text still needs to meet WCAG 2.2 contrast requirements against the background.

Loading Forge chat…