{# @description A daisyUI avatar: photo, initials, or a silhouette placeholder. #} {# @prop :for:text | description:"User to resolve an avatar_url lookup for, when src is unset. Defaults to request.user." #} {# @prop src:text | description:"URL for a profile photo. Falls back to the avatar_url lookup, then a placeholder/SVG." #} {# @prop alt:text | default:"User avatar" | description:"Alt text for the ." #} {# @prop size:text | default:"md" | description:"xs, sm, md, lg, xl or xxl, or any Tailwind w-* class." #} {# @prop shape:select['rounded','rounded-xl','rounded-full'] | default:"rounded-full" | description:"Corner rounding class." #} {# @prop variant:select['primary','secondary','accent','neutral'] | default:"primary" | description:"Initials background colour. The bare silhouette fallback is always muted." #} {# @prop status:select['online','offline'] | description:"Presence indicator. Unset shows none." #} {# @prop placeholder:text | description:"Initials or text shown when there's no image." #} {# @prop class:text | description:"Extra classes on the .avatar wrapper." #} {# @prop :size_options:text | hidden | description:"Internal size-to-width-class lookup table, not a caller-facing prop." #} {% load mvp cotton %} {% if not src %} {% avatar_url for size as src %} {% endif %}
{% if src %} {{ alt }} {% elif placeholder %} {{ placeholder }} {% else %} {% endif %}