Component Contract

Avatar

A circular representation of a person — photo, initials, or icon fallback.

Live Demo

Types

Rendered

Margaret ChenPhoto Initials Icon

Sizes

Rendered

sm 36px · md 48px · lg 64px

1. Summary

Component nameAvatar
AEM resource typecaat/components/avatar
TierBase (atom) — composes nothing but tokens
PurposeRepresent a person with a photo, or fall back to initials / a generic icon.
VariantsPhoto · Initials · Icon  ·  sm · md · lg
Status New
Replaces.caat-testimonial__avatar (Testimonials-internal)

Used by

  • Testimonials — member photo / initials.
  • Future: member portal header, advisor cards, comment threads.

2. Design Tokens

TokenRole
--caat-color-borderPhoto placeholder background (while loading)
--caat-color-bg-brand / --caat-color-text-inverseInitials & icon fallback fill + glyph
--caat-font-primaryInitials

3. Authoring Fields

FieldTypeRequiredNotes
ImageImageNoHeadshot; if empty, falls back to initials or icon
NameTextYesUsed for alt text and to derive initials
SizeSelectNosm · md (default) · lg

4. Validation Rules

No author-managed content beyond an accessible label, so there are no authoring validation rules. Accessibility requirements are covered in Section 8 (Accessibility).

5. Content Guidance

  • Prefer a real photo; use initials when none exists; use the icon only as a last resort (anonymous).
  • Initials = first letters of given + family name, uppercase, max 2 characters.
  • Keep avatars consistent in size within a single context (e.g. a testimonial grid).

6. Semantic HTML

<!-- Photo (meaningful → real alt) -->
<img class="caat-avatar" src="…" alt="Margaret Chen" width="48" height="48">

<!-- Initials / icon fallback (decorative → aria-hidden; name shown nearby) -->
<span class="caat-avatar caat-avatar--initials" aria-hidden="true">MC</span>
<span class="caat-avatar caat-avatar--icon" aria-hidden="true"><i class="bi bi-person-fill"></i></span>

7. CSS Contract

SelectorPurpose
.caat-avatarBase — 48px circle (photo or fallback)
.caat-avatar--initials / --iconBrand-fill fallbacks
.caat-avatar--sm / --lg36px / 64px

8. Accessibility

RequirementImplementation
Photo altMeaningful photo uses the person's name as alt.
FallbacksInitials/icon are aria-hidden="true" — the name is conveyed by adjacent text (e.g. testimonial name), so the avatar isn't announced twice.
ContrastWhite initials/glyph on brand navy fill — AA verified.
Not interactiveDecorative by default; if it links to a profile, wrap in a real link.

9. SEO

Transient / structural UI with no indexable content of its own — no SEO markup required. Ensure any content this component wraps or reveals stays server-rendered and crawlable.

10. Analytics

Analytics are captured through the shared data-analytics-component attribute on the component root (emitted automatically) and reported to the central data layer. Event names and payloads follow the organisation's standard analytics schema — defined centrally with the analytics team, not invented per component — so no bespoke tracking is specified here.

11. AEM Implementation Notes

  • Resource type: caat/components/avatar.
  • Sling model derives initials from name when no image is set; chooses the icon fallback if neither.

12. Dialog Model (cq:dialog)

Not authored directly. The avatar is a sub-element emitted and configured by its host component (or generated from page structure), so it has no standalone cq:dialog — any options are exposed through the host component's dialog.

13. QA Checklist

#CheckPass?
1Photo, initials, and icon all render as 48px circles
2Photo has name alt; fallbacks are aria-hidden
3Sizes sm/md/lg correct
4Initials/icon white on navy meet AA

14. Definition of Done

  • Token-driven; fallbacks AA verified.
  • Testimonials refactored to consume it (was .caat-testimonial__avatar).
  • Alt/aria behaviour verified.
  • QA checklist signed off.