Skip to content

Avatar

A circular (or shaped) user representation that renders an image, falls back to initials, and falls back again to a generic person icon. Supports online-presence status indicators, theme colors, and size variants.

Fallback to Initials

When no image is provided (or the image fails to load), the avatar displays initials derived from the alt attribute, or explicitly from initials.

PreviewCode
RTL
html
<ore-avatar alt="Jane Doe"></ore-avatar>
<ore-avatar initials="JD" color="primary"></ore-avatar>
<ore-avatar initials="AB" color="success"></ore-avatar>
<ore-avatar initials="XY" color="warning"></ore-avatar>

Colors

Use color to apply one of the semantic theme colors to the initials background.

PreviewCode
RTL
html
<ore-avatar initials="PR" color="primary"></ore-avatar>
<ore-avatar initials="SE" color="secondary"></ore-avatar>
<ore-avatar initials="IN" color="info"></ore-avatar>
<ore-avatar initials="SU" color="success"></ore-avatar>
<ore-avatar initials="WA" color="warning"></ore-avatar>
<ore-avatar initials="ER" color="error"></ore-avatar>

Sizes

PreviewCode
RTL
html
<ore-avatar initials="SM" size="sm"></ore-avatar>
<ore-avatar initials="MD" size="md"></ore-avatar>
<ore-avatar initials="LG" size="lg"></ore-avatar>

Rounded

Control the border-radius with rounded. Defaults to full (circular).

PreviewCode
RTL
html
<ore-avatar initials="SM" rounded="sm"></ore-avatar>
<ore-avatar initials="MD" rounded="md"></ore-avatar>
<ore-avatar initials="LG" rounded="lg"></ore-avatar>
<ore-avatar initials="FL" rounded="full"></ore-avatar>

Status Indicator

Add a colored status dot with the status attribute. Status indicator dots are visual only — pair them with a contextual label in the surrounding UI when the status is meaningful to assistive technology users.

PreviewCode
RTL
html
<ore-avatar initials="ON" color="primary" status="online"></ore-avatar>
<ore-avatar initials="OF" status="offline"></ore-avatar>
<ore-avatar initials="BU" color="error" status="busy"></ore-avatar>
<ore-avatar initials="AW" color="warning" status="away"></ore-avatar>

Avatar Group

Use ore-avatar-group to stack ore-avatar elements in an overlapping row with automatic overflow handling. When more avatars are provided than max allows, the excess count is shown in a +N badge.

PreviewCode
RTL
html
<ore-avatar-group max="3">
  <ore-avatar src="/a.jpg" alt="Alice" color="primary"></ore-avatar>
  <ore-avatar src="/b.jpg" alt="Bob" color="secondary"></ore-avatar>
  <ore-avatar src="/c.jpg" alt="Carol" color="success"></ore-avatar>
  <ore-avatar alt="Dave" color="warning"></ore-avatar>
</ore-avatar-group>

API Reference

ore-avatar Attributes

AttributeTypeDefaultDescription
srcstringImage source URL
altstringAlt text; also used to derive initials automatically
initialsstringExplicit initials (e.g. "JD") when no image loads
color'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'Theme color for initials background
size'sm' | 'md' | 'lg''md'Component size
rounded'sm' | 'md' | 'lg' | 'full''full'Border radius
status'online' | 'offline' | 'busy' | 'away'Online presence indicator dot

ore-avatar CSS Custom Properties

PropertyDescription
--avatar-sizeOverride the avatar width and height
--avatar-bgBackground color (initials background)
--avatar-colorText / icon foreground color
--avatar-radiusBorder radius
--avatar-borderBorder shorthand (e.g. 2px solid)
--avatar-border-colorBorder color (also used for status ring)
--avatar-font-sizeInitials font size
--avatar-font-weightInitials font weight

ore-avatar-group Attributes

AttributeTypeDefaultDescription
maxnumber5Maximum visible avatars. Excess avatars are hidden behind a +N badge
totalnumberOverride the count shown in the overflow badge (defaults to hidden count)

ore-avatar-group Slots

SlotDescription
(default)ore-avatar elements to group

ore-avatar-group CSS Parts

PartDescription
overflowThe +N overflow count badge

ore-avatar-group CSS Custom Properties

PropertyDescription
--avatar-group-overlapNegative margin creating the overlap (default: -0.75rem)

Accessibility

The avatar component follows WAI-ARIA best practices. Provide a meaningful alt attribute on each ore-avatar — it serves as the accessible name and is also used to derive initials automatically. Initials backgrounds are decorative; the alt text provides the accessible name for screen readers.