Angular Avatar Component | ng-hub-ui-avatar

Angular avatar component with initials, fallback images, presence badges and CSS variables for reusable user identity interfaces.

API reference

Here's the full contract for avatar: everything you can bind, listen to, project and theme, gathered in one place. Wire up what you need and style what you want — it's standalone and signal-friendly.

Inputs

Dial avatar in with 20 inputs. Bind them like any Angular @Input.

NameTypeDefaultDescription
sizestring | number50Avatar size in pixels
namestringUser name for generating initials when image sources fail
srcstring | SafeUrlPrimary custom image source URL for the avatar
altstringAlternative text for the avatar image for accessibility
roundbooleantrueWhether the avatar should be circular (true) or follow cornerRadius
bgColorstringBackground color for text avatars. Auto-generated if not provided
autoColorbooleantrueWhen `true` (default) an initials avatar derives its background from a hash of the name. Set to `false` to theme it through the `--hub-avatar-bg-color` variable instead; an explicit `bgColor` always wins.
fgColorstring#FFFText color for initials in text avatars
borderColorstringBorder color around the avatar
cornerRadiusstring | number0Corner radius when round is false
textSizeRationumber3Ratio to calculate text size from avatar size (size / textSizeRatio)
initialsSizestring | number0Restricts the number of initials displayed (0 = no restriction)
facebookIdstringFacebook user ID for profile picture (best-effort, API restrictions may apply)
githubIdstringGitHub username for fetching profile picture
gravatarIdstringGravatar email or MD5 hash for fetching profile picture
valuestringDisplay a custom value as avatar (e.g., "75%", "+5")
stylePartial<CSSStyleDeclaration>Custom styles to apply to the avatar root element
referrerpolicystringReferrer policy for the avatar image (e.g., "no-referrer")
badgestring | number | boolean | nullCorner overlay: `badge` / `[badge]="true"` → a dot; `badge="4k"` → a labelled pill; null / absent → nothing.
badgeColorHubAvatarBadgeColor | string | nullSemantic colour of the badge (primary · secondary · success · danger · warning · info · light · dark) → `--hub-sys-color-*`.

Outputs

React to what avatar does — 1 events to hook your logic onto.

NameTypeDescription
clickOnAvatarSourceEmitted when avatar is clicked, returns the current active source object

Templates

No templates documented yet.