Skip to content
+

Avatar

Avatars are found throughout material design with uses in everything from tables to dialog menus.

Image avatars

Image avatars can be created by passing standard img props src or srcSet to the component.

Remy Sharp
Travis Howard
Cindy Baker
Press Enter to start editing

Letter avatars

Avatars containing simple characters can be created by passing a string as children.

H
N
OP
Press Enter to start editing

You can use different background colors for the avatar. The following demo generates the color based on the name of the person.

KD
JW
TN
Press Enter to start editing

Sizes

You can change the size of the avatar with the height and width CSS properties.

Remy Sharp
Remy Sharp
Remy Sharp
Press Enter to start editing

Icon avatars

Icon avatars are created by passing an icon as children.

Press Enter to start editing

Variants

If you need square or rounded avatars, use the variant prop.

N
Press Enter to start editing

Fallbacks

If there is an error loading the avatar image, the component falls back to an alternative in the following order:

  • the provided children
  • the first letter of the alt text
  • a generic avatar icon
Remy Sharp
Remy Sharp
Press Enter to start editing

Grouped

AvatarGroup renders its children as a stack. Use the max prop to limit the number of avatars.

+2
Cindy Baker
Travis Howard
Remy Sharp
Press Enter to start editing

Total avatars

If you need to control the total number of avatars not shown, you can use the total prop.

+20
Trevor Henderson
Agnes Walker
Travis Howard
Remy Sharp
Press Enter to start editing

Custom surplus

Set the renderSurplus prop as a callback to customize the surplus avatar. The callback will receive the surplus number as an argument based on the children and the max prop, and should return a React.ReactNode.

The renderSurplus prop is useful when you need to render the surplus based on the data sent from the server.

+4k
Trevor Henderson
Agnes Walker
Travis Howard
Remy Sharp
Press Enter to start editing

With badge

Remy Sharp
Travis Howard
Remy Sharp
Press Enter to start editing

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.