ClickorAltL

Dragto resize

Nord Design System SearchDeveloperDeveloperGetting startedUsing Web ComponentsWebfontsCDNLocalizationCSS Framework Legacy ESLint PluginWorking with AIFAQDesignDesignGetting startedFoundationsThemesBrand assetsToolsComponentsComponentsAccordion New Aside New Autocomplete New AvatarBadgeBanner Updated ButtonButton GroupCalendar Updated CardCheckbox Updated Collapsible New Combobox New Command MenuDate Picker Updated Date Range Picker New DividerDrawerDropdownEmpty StateField New FieldsetFilter Bar New FooterHeaderIconInput Updated Item New Kbd New LayoutMessageMeter New ModalNavigationNotificationNumber Field New Otp Field New Outline New Pagination New Popout Updated ProgressProgress BarQrcodeRadio Updated Range Updated Scroll Area New Segmented ControlSelect Updated SkeletonSpinnerStackTabTableTagTextarea Updated Time Picker New ToastToggle Updated TooltipTop BarTruncate New Visually HiddenDesign TokensDesign TokensTailwind CSSTailwind CSSBlocksBlocksTemplatesTemplatesIconsIconsPlaygroundPlaygroundLatest UpdatesLatest UpdatesChangelogChangelogMigration guidesMigration guides
GitHub

Avatar

Open in Storybook

A visual representation of a user or entity, shown as an image, initials, or icon.

Loading...

Usage

Avatar represents a user or entity as an image, initials, or an icon. Give it a name for the accessible label and initials fallback, and an optional src for a photo.

Copy code
import "@nordhealth/components/lib/Avatar"

Examples

Sizes

Set size to one of s, m, l, xl, xxl, or xxxl.

Initials

With no src, the avatar shows initials derived from name (or the text you provide as content) across every size.

Image

Provide a src to show a photo; the name is still used as the accessible label and the fallback if the image fails to load.

Image sizes

The same photo shown at each available size.

Icon

Use icon to show an icon instead of initials.

Icon sizes

An icon avatar rendered across every size.

Square

Use variant="square" for non-person entities such as organisations.

Square sizes

A square avatar with initials shown at each available size.

With tooltip

Pair an avatar with a Tooltip to reveal the full name or status on hover and focus.

Patients and clients

Avatars use animal-category icons to represent patients across species.

Users

Guidance for staff, clinic, and blank avatars, including when to fall back to initials or a silhouette.

RTL

Avatar follows the document or container direction. Toggle the direction to see the layout mirror.

Accessibility

  • Always provide a name — it is used as the avatar's accessible label and to derive the initials shown when there is no image.
  • When an src image fails to load, the avatar falls back to the initials from name, so the identity is never lost.
  • Decisions conveyed only by avatar colour should be reinforced elsewhere; colour alone isn't accessible.

API reference

Avatar

Avatar is used for showing a thumbnail representation of a single user or entity. Default avatar illustration is displayed when no src is specified.

<nord-avatar></nord-avatar>

Props

PropertyAttribute Description TypeDefault
sizesizeThe size of the avatar.'s' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl''m'
srcsrcThe URL of the avatar image uploaded by the user.string | undefined
namenameThe name of the person or entity.string''
iconiconThe fallback icon.string | undefined
variantvariantThe style variant of the avatar.'default' | 'square''default'

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-avatar-colorControls the color of the avatar fallback, using color tokens.var(--n-color-status-highlight)
--n-avatar-sizeControls the size of the avatar, using icon sizing tokens.var(--n-size-icon-l)
--n-avatar-box-shadowControls the box shadow for the avatar.none
--n-avatar-text-colorControls the color of the avatar’s text and icon, using color tokens.var(--n-color-text-on-accent)
Design guidelinesFor designers

Usage

This section includes guidelines for designers and developers about the usage of this component in different contexts.

Do

  • Use the circle avatar to represent a single user or an animal.
  • Use the square avatar for organizations or group of animals.
  • Always add the name of the user, animal, organization, or group of animals using the name property.
  • For the best results, use square images or images cropped into a square.

Don’t

  • Don’t use the circle avatar to represent organizations or group of animals.
  • Don’t use the square avatar to represent a single user or an animal.
  • Don’t use an avatar when an icon is more suitable, for example when denoting groups or "things".
  • Try to avoid using landscape or portrait images as avatars. Let users crop their images before or after uploading if possible.