Avatar
Avatar shows a person, a team or a thing as a small round picture, with initials or a generic figure until the picture loads.
An avatar shows a person, a team or a thing as a small round picture. Before the picture loads, or if it fails, the avatar shows its fallback, which is usually a person's initials. Without a fallback, it shows a generic person icon.
Use AvatarGroup to show several avatars that overlap. Use a Chip for a word beside a person, such as a role or a status. An avatar does not respond to a press, so for an account menu, put the avatar inside an icon-only Button.
Sizes 1 to 4 match the control heights, so an avatar is as tall as a Button of the same size and grows with density and on touch screens. Sizes 5 to 9 are larger, for a face that stands alone. If you leave size unset, the avatar uses the size of its group, and then the size of the nearest Theme.
Pass a Badge to badge to show a count or a dot at the top-end corner. The avatar positions the badge and cuts a ring in the surface colour around it, so the badge stays separate from the picture.
An avatar is a circle at every radius setting, and its fallback is always grey. Set backdrop when content passes behind the avatar, so the fallback uses your Theme's material; a loaded picture covers the material.
alt is empty by default, so a screen reader skips the avatar. That is correct when the person's name is written beside it. When the avatar is the only thing that identifies the person, write their name in alt, and the fallback then uses the same name.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
alt? | string | The text alternative for the picture. |
backdrop? | boolean | Set backdrop when the avatar sits over other content, such as an image. |
badge? | React.ReactNode | A Badge in the top-end corner of the avatar, such as a count or a dot. |
fallback? | React.ReactNode | The content that shows when there is no picture, usually initials. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | The size step of the avatar, from 1 to 9. |
src? | string | The picture. |
It also takes every prop of a <span>.
- A shape prop — An avatar is a circle at every radius setting, so it is always recognisable as a person or a team. For a square picture, use an image in a Card or a Box.
emphasis— No person on the screen is more important than another because of their avatar. Show order and importance with the position and the size of the avatars.tone— A tone could colour only the initials, which is too weak to identify a person. The picture is what makes one avatar different from the next.- Built-in status words — Words such as Away or Busy belong to your product, not to the avatar. Use the
badgeprop for a count or a dot, or put a Chip next to the avatar. - A press — An avatar is not a control. When people need to press a person, put the avatar inside an icon-only Button, which gives it focus and an accessible name.
- A maximum count on the group — How many faces to show is a decision for your product. Show the ones you want, then add one more Avatar whose fallback counts the rest, such as +3.