ORB Building Block · v1 · 2026-10-01

Avatar Fallback

A drop-in avatar component with two variants: initials (default, privacy-safe) and photo (opt-in, gracefully falls back to initials on error). Three sizes, zero backend, no biometric data by default.

The component at a glance

What it does

The avatar renders as colored initials by default. If the user opts in to a real photo, the component renders that image; if the image URL ever 404s, the component silently falls back to the initials version. The member never sees a broken-image icon.

This pattern resolves the tension from idea-10 (profile display: head-shot + first name as default) and idea-11 (avatar fallback). Members choose either a photo or initials — never both required, never a default that captures biometric data without consent.

Demo · Initials (default)

Privacy-safe by default

Three sizes of the same member, initials variant only:

Alex Rivera
Default variant · lg size · no photo data
No image, no risk. The initials variant has no image source, so there's no biometric data collected, no upload, no CDN dependency, no broken-image state.
Demo · Photo (opt-in)

Photo variant with graceful fallback

When a member chooses to share a photo, the component renders it. If the URL fails, it falls back to initials — quietly, with no flash of broken-image.

Photo loaded
Photo error → falls back
Initials only (no photo attr)
Photo URLs must be member-controlled. The data-photo attribute is whatever the member uploads to the FlexiFunnels Media Library — never an external third-party URL that tracks the viewer.
Demo · In use

Common placements

Comment thread
Mira Chen Three weeks into the new dashboard polish and the difference is real — the timer no longer fights the rest of the page.
Devon Walker Initials-only default is the right call. Removes the pressure to "look professional" before the work is even done.
Priya Shah Photo upload took five seconds. Image renders, fallback works, no complaints.
Byline + meta
Posted by Operator · 2 days ago
How to use

Drop-in markup

Paste the markup below anywhere on a page. Set the variant, name, and (optionally) size and photo URL.

<span class="orb-avatar"
      data-variant="initials"      <!-- "initials" or "photo" -->
      data-name="Alex Rivera"      <!-- used to derive initials -->
      data-size="md"             <!-- "sm" (32px), "md" (44px), "lg" (72px) -->
></span>

<!-- With photo (photo variant): -->
<span class="orb-avatar"
      data-variant="photo"
      data-name="Jordan Lee"
      data-size="md"
      data-photo="https://your-cdn.example/photo.jpg"
></span>

Required on every page that uses the component

Paste this once per page, anywhere in the body (typically just before </body>). The script auto-derives initials from data-name, inserts an <img> for the photo variant, and wires the error-fallback.

<script>
(function () {
  function initials(name) {
    if (!name) return '?';
    var parts = name.trim().split(/\s+/);
    if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
    return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
  }
  function deriveColor(name) {
    // Stable per-name background color from a small accent ramp.
    var palette = ['#b04a2f', '#2e7d52', '#b58900', '#5b8cff', '#7c5bff', '#2a8a8a'];
    var sum = 0;
    for (var i = 0; i < name.length; i++) sum = (sum + name.charCodeAt(i)) | 0;
    return palette[Math.abs(sum) % palette.length];
  }
  function render(el) {
    var variant = el.dataset.variant || 'initials';
    var name = el.dataset.name || '';
    var size = el.dataset.size || 'md';
    el.setAttribute('data-size', size);
    var text = initials(name);
    el.setAttribute('aria-label', name);
    var span = document.createElement('span');
    span.className = 'orb-avatar__initials';
    span.textContent = text;
    el.appendChild(span);
    el.style.background = deriveColor(name);
    if (variant === 'photo' && el.dataset.photo) {
      var img = document.createElement('img');
      img.src = el.dataset.photo;
      img.alt = name;
      img.onerror = function () { el.setAttribute('data-state', 'error'); };
      img.onload = function () { el.setAttribute('data-state', 'ok'); };
      el.appendChild(img);
    }
  }
  function init(root) {
    var nodes = (root || document).querySelectorAll('.orb-avatar');
    nodes.forEach(render);
  }
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
  } else {
    init();
  }
  window.ORBAvatar = { init: init, render: render };
})();
</script>
Why this exists

The decision it encodes

Re-use it anywhere. Profile chips, comment threads, bylines, partner cards, teleservant cards, leaderboards — same markup, same script, same look. Update House Style Tokens once and every avatar in the operation shifts with it.