Skip to content

Displays an avatar with an image and fallback to initials.

atlas-avatar

Examples

Image, fallback and sizes

src shows the image; without it, or when it fails to load, the avatar shows initials from alt (first and last name) or a custom fallback . size is sm , md (default) or lg .

Ada LovelaceGrace HopperAlan TuringMargaret Hamilton

Accessible name

Like an <img> : alt is the person's name for screen readers whether the image or the initials show. Without alt the avatar is decorative — use that when the name is written next to it, so it is read once.

  • Avatar only, named "Grace Hopper"
  • Ada Lovelace

Sizes and image fallback

size takes sm , md or lg . When src is missing or fails to load, the avatar shows the initials from fallback (or from alt ) instead of a broken image.

Alan Turing

API

Generated from the library source, so it always matches the code.

AtlasAvatarComponent atlas-avatar

InputTypeDefaultDescription
src string | nullnull Image URL. When it is missing or fails to load, the initials (from fallback or alt ) show instead.
alt string'' The person's name: the image's alt , the fallback's accessible name, and the source of the initials. Leave it empty when the name is written next to the avatar: it is then decorative.
fallback string'' Text shown instead of initials computed from alt (for example "JD").
size 'sm' | 'md' | 'lg''md' Diameter: sm , md or lg .
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.