Skip to main content

Avatar

BasicData display<co-avatar>

Avatar shows a person as a photo or initials, in five sizes, with an optional presence dot.

import { Avatar } from 'health-components';

Examples​

Showcase​

Storybook

Sizes​

Storybook

Colors​

Storybook

Photo​

Storybook

Usage​

<Avatar name="Henna West" size="lg" />
<Avatar name="Mandy Harley LCSW" size="sm" status="online" />

When to use​

  • Patients in banners and search results, staff in chat, care team, assignees.

When not to use​

  • Decoration in empty states.

Variants and states​

VariantWhat it is
initialsFirst and last initial; titles (MD, LCSW) are skipped.
photosrc image, round.
sizesxs 20, sm 30, md 40, lg 48, xl 64.
colourprimary (patients), accent (signed-in user), ai (AI agents), success-strong, ink-2.
statusonline, busy, away, offline dot with a surface ring.

Accessibility​

  • role img with the full name and status in aria-label.
  • Initials on accent: below 4.5:1 in Focus Rail (coral) and Command Bar (gold). Source pair kept; see README contrast list.

Do and don't​

  • Do: Initials for patients without a photo on file.
  • Don't: Stock photos for patients.

Props​

PropTypeDefaultDescription
name *string—Full name; gives the initials and the accessible name. Required
srcstringnone (initials)Photo URL
sizeAvatarSize'md''xs' 20 | 'sm' 30 | 'md' 40 | 'lg' 48 | 'xl' 64
colorAvatarColor'primary'Initials background: 'primary' (patients) | 'accent' (signed-in user) | 'ai' | 'success-strong' | 'ink-2'
statusAvatarStatusnonePresence dot: 'online' | 'busy' | 'away' | 'offline'

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-avatar>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-avatar name="…" src="…" [defaultValue]="defaultValue"></co-avatar>
KindNameDescription
attributenameFull name; gives the initials and the accessible name. Required
attributesrcPhoto URL; default none (initials)
attributesize'xs' 20 | 'sm' 30 | 'md' 40 | 'lg' 48 | 'xl' 64; default 'md'
attributecolorInitials background: 'primary' (patients) | 'accent' (signed-in user) | 'ai' | 'success-strong' | 'ink-2'; default 'primary'
attributestatusPresence dot: 'online' | 'busy' | 'away' | 'offline'; default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus