OGE logoOGE

Avatar & Badge

oge-avatar, oge-avatar-group and oge-badge. An avatar runs its own fallback chain — image, initials, icon — and names itself as one role="img", presence included; a group collapses its surplus into "+N".

A badge glyph is always aria-hidden: a bare "5" next to a button says nothing. What a screen reader hears is the description — "5 new items" — wired into the wrapped control's aria-describedby, so it is read with the control's name.

role=img fallback chain aria-describedby 99+

Image, initials & icon

The fallback chain runs on its own: the image while src loads, the initials (explicit, or derived from name — first and last word, upper-cased in the locale) when it fails, the person icon without either. A new src gets a fresh attempt.

src initials icon imageFailed

imageFailed → —

Sizes & shapes

Five sizes (24 to 64 px) on one host-local knob, so the image, the initials and the icon all fill the same box and the fallback never shifts layout. rounded uses the --oge-radius-lg token.

size shape

Presence status

The dot is aria-hidden; the presence joins the accessible name ("Ada Lovelace (Online)") through the catalog’s withStatus pattern. Offline is a hollow ring, so the state never rides on colour alone. Beside a visible name, decorative hides the avatar from assistive technology.

status decorative
Ada Lovelace

Avatar group

max counts the rendered circles including the surplus one, so the row never grows past it; total adds the rest of a partially loaded list. The "+N" avatar is a role="img" named "N more", and the group a labelled role="group".

items max total overlap

Badge on an element

Content inside the badge becomes its anchor. The glyph sits on a logical corner (mirrors in RTL) and is aria-hidden; the wrapped control’s aria-describedby points at the description, so a screen reader hears "Inbox, 5 new items". Above max it shows 99+; overlap="circle" sits on a round host’s outline.

value max position overlap aria-describedby
5 new itemsMore than 99 new itemsAvailable

Standalone badge & dot

Without content the badge is an inline pill with a visually hidden description. A zero count hides unless showZero; invisible force-hides; a string value ("Beta") reads itself.

dot showZero severity size
Messages 3 new itemsPlan BetaUpdates New updatesErrors 0 new items

Live announcements

announce speaks later changes through a polite live region. The initial value is part of the page and is never announced — only what changes while the reader is there.

announce aria-live=polite
1 items in cart

Configuration

Application- or component-scoped defaults. Every user-facing string — presence labels, "N more", the badge descriptions and the "99+" pattern — lives in a messages catalog, and the ready-made language packs cover it.

provideOgeAvatarConfig provideOgeBadgeConfig
12 new items