OGE logoOGE

Avatar & Badge API

Full surface of oge-avatar, oge-avatar-group and oge-badge, and their config providers.

Properties Events Types

OgeAvatar

oge-avatar

Properties 11

Name Type DefaultDescription
namestring | undefined—Person or entity name — the accessible name and the initials source (first letter of the first and last word, upper-cased in the locale).
srcstring | undefined—Image URL. A failed load falls back to the initials, then the icon; a new src gets a fresh attempt.
initialsstring | undefined—Explicit initials, overriding the ones derived from name.
iconstring | undefinedperson glyphSVG path data (d, 24×24 viewBox) of the last fallback; OGE_AVATAR_ICON_PATH by default.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'config → group → 'md'Size preset — 24 / 32 / 40 / 48 / 64 px.
shape'circle' | 'rounded' | 'square'config → group → 'circle'Outline; rounded uses --oge-radius-lg.
status'online' | 'away' | 'busy' | 'offline' | undefined—Presence dot (aria-hidden) — the presence label joins the accessible name through the withStatus message. Offline is a hollow ring, so the state never rides on colour alone.
decorativebooleanfalseThe name is already visible beside it: the host becomes aria-hidden with no role, so it is not read twice.
ariaLabelstring | undefined—Accessible name override; otherwise name, else the catalog’s avatar (the host is role="img").
imageLoading'lazy' | 'eager''lazy'Native loading of the image.
localestring | undefined—BCP 47 locale of the initials casing; undefined = config locale → LOCALE_ID.

Events 2

Name Type Description
imageLoadedOgeAvatarImageLoadedEventThe image at src loaded.
imageFailedOgeAvatarImageFailedEventThe image at src failed; the avatar now shows its initials or icon.

Types 5

Name Type Description
OgeAvatarSize'xs' | 'sm' | 'md' | 'lg' | 'xl'Size vocabulary.
OgeAvatarShape'circle' | 'rounded' | 'square'Shape vocabulary.
OgeAvatarStatus'online' | 'away' | 'busy' | 'offline'Presence vocabulary.
OgeAvatarImageLoadedEvent{ src: string; event: Event }Payload of imageLoaded.
OgeAvatarImageFailedEvent{ src: string; event: Event }Payload of imageFailed.

OgeAvatarGroup

oge-avatar-group

Properties 8

Name Type DefaultDescription
itemsreadonly OgeAvatarItem[][]Data-driven avatars, rendered before any projected <oge-avatar> children.
maxnumber | undefined—Rendered circles including the "+N" one (minimum 2), so the row never grows past it; undefined renders all.
totalnumber | undefined—Full population of a partially loaded list — the members not in the list count into "+N".
sizeOgeAvatarSize | undefinedconfig → 'md'Size of every avatar in the group (a child’s own size wins).
shapeOgeAvatarShape | undefinedconfig → 'circle'Shape of every avatar in the group (a child’s own shape wins).
overlapbooleantrueStack the avatars with a ring in the page surface; false spaces them.
ariaLabelstring | undefined—Accessible name; the host becomes role="group" once it has one. The surplus avatar is a role="img" named by the overflow message ("4 more").
localestring | undefined—BCP 47 locale of the "+N" digits and its plural label; undefined = config → LOCALE_ID.

Types 1

Name Type Description
OgeAvatarItem{ key?; name?; src?; initials?; status?; icon? }One avatar of the data-driven items.

OgeBadge

oge-badge

Properties 12

Name Type DefaultDescription
valuenumber | string | null | undefinednullA count (digits in the locale), a short text shown verbatim, or null — no badge.
maxnumber | undefinedconfig → 99Counts above it show the overflow pattern ("99+").
dotbooleanfalseA small dot instead of a value; described by the dot message.
showZerobooleanfalseShow a 0 count — hidden by default, "nothing new" needs no badge.
invisiblebooleanfalseForce-hide the badge, e.g. while a count loads.
severity'danger' | 'accent' | 'success' | 'warning' | 'neutral' | undefinedconfig → 'danger'Colour; danger paints the --oge-badge-bg / --oge-badge-color tokens.
size'sm' | 'md''md'Size preset of the count badge (the dot has one size).
position'top-end' | 'top-start' | 'bottom-end' | 'bottom-start' | undefinedconfig → 'top-end'Corner of the wrapped content — logical, so RTL mirrors it.
overlap'rectangle' | 'circle''rectangle'circle pulls the badge onto the outline of a round host (an avatar) instead of its bounding box.
descriptionstring | undefined—Accessible text override. The default reads the catalog: "5 new items", "More than 99 new items", "New" for a dot, a text value itself. An overlay badge points the wrapped control’s aria-describedby at it; a standalone one renders it visually hidden.
announcebooleanfalseSpeak later changes of the description through a polite live region. The initial value is never announced.
localestring | undefined—BCP 47 locale of the digits and the plural description; undefined = config → LOCALE_ID.

Types 5

Name Type Description
OgeBadgeValuenumber | string | null | undefinedWhat a badge shows.
OgeBadgeSeverity'danger' | 'accent' | 'success' | 'warning' | 'neutral'Colour vocabulary.
OgeBadgePosition'top-end' | 'top-start' | 'bottom-end' | 'bottom-start'Logical corner vocabulary.
OgeBadgeOverlap'rectangle' | 'circle'Shape of the wrapped content.
OgeBadgeSize'sm' | 'md'Size vocabulary.

Configuration

Properties 6

provideOgeAvatarConfig()

Name Type Description
messagesOgeAvatarMessagesEvery user-facing string: avatar (fallback name, "Avatar"), withStatus ("{name} ({status})"), the presence labels online / away / busy / offline, and overflow — the ICU plural naming the surplus avatar ("{count, plural, one {# more} other {# more}}").
size / shape—Defaults for the matching inputs of the avatar and the group.
localestring | undefinedDefault locale of the initials casing and the "+N" digits (provideOgeLocale() sets it from the pack).

provideOgeBadgeConfig()

Name Type Description
messagesOgeBadgeMessagesEvery user-facing string: count (ICU plural, "5 new items"), overflow ("{max}+"), overflowCount ("More than 99 new items") and dot ("New").
max / severity / position—Defaults for the matching inputs.
localestring | undefinedDefault locale of the digits and the plural description.

Types 6

Name Type Description
OgeAvatarConfig / OgeAvatarConfigInputinterfaceResolved config and its partial input (messages merged one level deep).
OgeAvatarMessagesinterfaceThe avatar catalog (layout.avatar in the locale packs).
OgeBadgeConfig / OgeBadgeConfigInputinterfaceResolved config and its partial input.
OgeBadgeMessagesinterfaceThe badge catalog (layout.badge in the locale packs).
OGE_AVATAR_CONFIG / OGE_BADGE_CONFIGInjectionTokenThe DI tokens the providers write.
OGE_DEFAULT_AVATAR_CONFIG / OGE_DEFAULT_AVATAR_MESSAGES / OGE_DEFAULT_BADGE_CONFIG / OGE_DEFAULT_BADGE_MESSAGESconstThe English defaults (from @oge-ui/behavior).