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.
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
<Avatar alt="Travis Howard" src="/static/images/avatar/2.jpg" />
<Avatar alt="Cindy Baker" src="/static/images/avatar/3.jpg" />
H
N
OP
<Avatar>H</Avatar>
<Avatar className={classes.orange}>N</Avatar>
<Avatar className={classes.purple}>OP</Avatar>
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.small} />
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.large} />
<Avatar>
<FolderIcon />
</Avatar>
<Avatar className={classes.pink}>
<PageviewIcon />
</Avatar>
<Avatar className={classes.green}>
<AssignmentIcon />
</Avatar>
N
<Avatar variant="square" className={classes.square}>
N
</Avatar>
<Avatar variant="rounded" className={classes.rounded}>
<AssignmentIcon />
</Avatar>
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
<Avatar alt="Remy Sharp" src="/broken-image.jpg" className={classes.orange}>
B
</Avatar>
<Avatar alt="Remy Sharp" src="/broken-image.jpg" className={classes.orange} />
<Avatar src="/broken-image.jpg" />
+2
<AvatarGroup max={4}>
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
<Avatar alt="Travis Howard" src="/static/images/avatar/2.jpg" />
<Avatar alt="Cindy Baker" src="/static/images/avatar/3.jpg" />
<Avatar alt="Agnes Walker" src="/static/images/avatar/4.jpg" />
<Avatar alt="Trevor Henderson" src="/static/images/avatar/5.jpg" />
</AvatarGroup>