Vue playground

Nova v3.37.0

Preview

Vue

Avatar

nv-avatar

A small round image, initials or icon that represents a person or an account.

Live demo

Src
Size

Use an avatar to represent a person or account in lists, comments, headers and menus. Show the person's name beside it; the avatar helps recognition but does not replace the name.

Content types

An avatar shows one of three things, in this order:

  1. Image from src, with alt describing who it shows.
  2. Initials from initials, trimmed to two characters. The application decides which letters to use.
  3. Icon: a default user icon, or your own icon in the icon slot, for guests or shared accounts.

A broken image does not fall back to initials automatically; clear src when your application knows an image is unavailable.

src
initials
icon · default

Size and colour

size offers xs, sm, md (the default), lg and xl. color picks one of ten background colours: amber, orange, yellow, red, turquoise, crimson, green, petrol, lime and gray. The older values 1 to 10 still work. Colours have no meaning of their own, so keep a person's colour stable, for example by deriving it from their name.

xs
sm
md · default
lg
xl
amber
orange
yellow
red
turquoise
crimson
green
petrol
lime
gray

Guidelines

  • Use two-letter initials, such as the first letters of the first and last names.
  • Use one size within a list.
  • Don't rely on colour or the image alone to identify someone.
DoUse one size and two-letter initials within a list.
Don'tAvoid mixing sizes within one list.

Accessibility

Set alt to the person's name when the avatar identifies them without adjacent text; the component uses it on the host and image. If the same name is already visible and the avatar adds no information, hide the decorative avatar with aria-hidden="true".

The design page describes keyboard access, but an avatar is not an interactive control by itself. Put a clickable profile avatar inside a labelled link or button, and let that control provide keyboard behaviour and focus styling.

Sources