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
Sizes
Colors
Photo
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
| Variant | What it is |
|---|---|
| initials | First and last initial; titles (MD, LCSW) are skipped. |
| photo | src image, round. |
| sizes | xs 20, sm 30, md 40, lg 48, xl 64. |
| colour | primary (patients), accent (signed-in user), ai (AI agents), success-strong, ink-2. |
| status | online, 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
| Prop | Type | Default | Description |
|---|---|---|---|
name * | string | — | Full name; gives the initials and the accessible name. Required |
src | string | none (initials) | Photo URL |
size | AvatarSize | 'md' | 'xs' 20 | 'sm' 30 | 'md' 40 | 'lg' 48 | 'xl' 64 |
color | AvatarColor | 'primary' | Initials background: 'primary' (patients) | 'accent' (signed-in user) | 'ai' | 'success-strong' | 'ink-2' |
status | AvatarStatus | none | Presence 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>
| Kind | Name | Description |
|---|---|---|
| attribute | name | Full name; gives the initials and the accessible name. Required |
| attribute | src | Photo URL; default none (initials) |
| attribute | size | 'xs' 20 | 'sm' 30 | 'md' 40 | 'lg' 48 | 'xl' 64; default 'md' |
| attribute | color | Initials background: 'primary' (patients) | 'accent' (signed-in user) | 'ai' | 'success-strong' | 'ink-2'; default 'primary' |
| attribute | status | Presence dot: 'online' | 'busy' | 'away' | 'offline'; default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus |