// preview in
saved for every page

Avatar

A person's photo, or their initials when there is no photo. Use it next to names in comments, lists and profiles, so people recognize each other faster.

Built on Base UIPattern WAI-ARIA img / groupClient componentSource ↗
minimal · light · #3fa34d
SM
size

Installation

Set up Camaleo once (Installation), then import what you need. It renders on the client, because it waits for the photo to load.

import { Avatar, AvatarGroup } from "@camaleo/react";

Anatomy

A round box that holds the photo, or the fallback while the photo loads or when it fails. AvatarGroup overlaps several of them.

Examples

Every example is a real file you can copy. They all wear the skin, mode and brand from the bar above.

minimal · light · #3fa34d
SM
SM

With a photo

On its own, the avatar must say who it is. Put the person's name in alt, never "photo" or "avatar".

Sofia MendesHead of customer support

Next to the name

When the name is right beside it, hide the avatar with aria-hidden. Otherwise screen readers say the name twice.

  • Camila Pradosm · comments and dense lists
  • Eduardo Ramosmd · the default, for menus and cards
  • Lucas Ferreiralg · profile headers

Sizes

Small for comments and dense lists, medium for menus and cards, large for the top of a profile. Keep one size per list.

CPER

Initials and icon

Without a photo, two initials still tell people apart. Use the icon for guests and accounts without a name. alt names the avatar whether the photo or the fallback is showing, so screen readers hear the name, not the initials.

Nina Rocha

Photo that fails

If the photo doesn't load, the initials stay in place. Always pass a fallback, so a broken link never leaves an empty circle.

CPERLFMS+3

Group with a count

Show a few faces and a "+3" for the rest. Name the group with the total, like "7 people on…", and give "+3" its own name.

Sofia MendesOnline

Presence

Click the button. The status is a word in a badge, not just a green dot, and a status region reads the change aloud.

In context

Avatars put a face next to what people did. These are whole pieces of UI you can copy, in the skin you picked.

Camila Prado2 hours ago

I checked the new invoice layout on a phone. The totals no longer wrap, nice work!

CommentCard · Avatar

Lucas Ferreira

Product designer

Leads the checkout flow and runs the monthly usability sessions.

Team member cardCard · Avatar · Button
Eduardo Ramos merged fix/invoice-rounding
Activity feedCard · Avatar

Guidelines

Mariana Lima
DoSay the name once.

With the name next to it, the avatar is decoration: hide it from screen readers.

MLMariana Lima
Don’t"Photo of…" next to the name.

Screen readers hear "Photo of Mariana Lima, Mariana Lima". The repeat adds nothing.

André Santos
DoTwo initials.

First and last name initials tell people apart, even without a photo.

André Santos
Don’tA question mark.

"?" looks like an error and says nothing about who it is.

Props

PropTypeDefaultDescription
srcstring—URL of the photo. Until it loads, or if it fails, the fallback shows instead.
altstring""The person's name, read by screen readers. It only applies to the photo: while the fallback shows, name the avatar with role="img" and aria-label, or hide it with aria-hidden when the name is next to it.
fallbackReactNode—What shows without a photo, while it loads or when it fails: usually two initials, or an icon.
size"lg" | "md" | "sm""md"sm for comments and dense lists, md for menus and cards, lg for profile headers.

Other attributes, like role, aria-label and aria-hidden, go to the outer <span>. AvatarGroup renders a <div role="group"> and needs an aria-label.

Styling hooks

Restyle it without forking: target the attributes, or set the tokens on a parent, a skin or the avatar itself.

Attributes

data-sizesm · md · lg

Tokens it reads

Color

--cml-accent--cml-accent-text--cml-surface--cml-surface-raised

Shape & size

--cml-radius-pill

Type & motion

--cml-font-control--cml-font-weight-control

This component only

--cml-avatar-fg--cml-avatar-ring--cml-avatar-size--cml-corner-shape

Accessibility

—An avatar never takes focus. To open a profile, wrap it with the name in a link.
Was this page helpful? · Edit this page on GitHub